mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-08 11:57:51 +00:00
Fix errors on creating pql Call
This commit is contained in:
parent
d740a0cda7
commit
3fb79b4d97
2 changed files with 4 additions and 5 deletions
|
|
@ -1322,15 +1322,14 @@ func (e *executor) executePercentile(ctx context.Context, qcx *Qcx, index string
|
|||
return ValCount{}, errors.Wrap(err, "executing Max call for Percentile")
|
||||
}
|
||||
// set up reusables
|
||||
countQuery, _ := pql.ParseString("Count(Row(fld < 0))")
|
||||
countQuery, _ := pql.ParseString(fmt.Sprintf("Count(Row(%s < 0))", fieldName))
|
||||
countCall := countQuery.Calls[0]
|
||||
rangeQuery, _ := pql.ParseString("Row(fld < 0)")
|
||||
rangeCall := rangeQuery.Calls[0]
|
||||
rangeCall := countCall.Children[0]
|
||||
|
||||
min, max := minVal.Val, maxVal.Val
|
||||
// estimate nth val, eg median when nth=0.5
|
||||
for min < max {
|
||||
possibleNthVal := (max - min) / 2
|
||||
possibleNthVal := (max + min) / 2
|
||||
// get left count
|
||||
rangeCall.Args[fieldName] = &pql.Condition{
|
||||
Op: pql.Token(pql.LT),
|
||||
|
|
|
|||
|
|
@ -6896,7 +6896,7 @@ func variousQueriesOnPercentiles(t *testing.T, clusterSize int) {
|
|||
// Rows
|
||||
{
|
||||
query: `Percentile(field="net_worth", nth=0.5)`,
|
||||
csvVerifier: "10,1\n",
|
||||
csvVerifier: "40,1\n",
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue