mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-05 08:10:50 +00:00
Merge pull request #1641 from molecula/ma/cloud-119
CLOUD-119 CORE-653 Fix percentile query
This commit is contained in:
commit
5187d3f862
3 changed files with 8 additions and 2 deletions
|
|
@ -1239,10 +1239,10 @@ func (e *executor) executePercentile(ctx context.Context, qcx *Qcx, index string
|
|||
}
|
||||
|
||||
// get field
|
||||
if fieldArg := c.Args["field"]; fieldArg == "" {
|
||||
fieldName, err := c.FirstStringArg("field", "_field")
|
||||
if err != nil {
|
||||
return ValCount{}, errors.New("Percentile(): field required")
|
||||
}
|
||||
fieldName, _, _ := c.StringArg("field")
|
||||
|
||||
// filter call for min & max
|
||||
var filterCall *pql.Call
|
||||
|
|
|
|||
|
|
@ -7026,6 +7026,11 @@ func variousQueriesOnPercentiles(t *testing.T, c *test.Cluster) {
|
|||
query: query,
|
||||
csvVerifier: fmt.Sprintf("%d,1\n", expectedPercentile),
|
||||
})
|
||||
query2 := fmt.Sprintf(`Percentile(field=net_worth, filter=Row(val="foo"), nth=%d)`, nth)
|
||||
tests = append(tests, testCase{
|
||||
query: query2,
|
||||
csvVerifier: fmt.Sprintf("%d,1\n", expectedPercentile),
|
||||
})
|
||||
}
|
||||
|
||||
for i, tst := range tests {
|
||||
|
|
|
|||
|
|
@ -481,6 +481,7 @@ var callInfoByFunc = map[string]callInfo{
|
|||
allowUnknown: false,
|
||||
prototypes: map[string]interface{}{
|
||||
"field": "",
|
||||
"_field": "",
|
||||
"filter": nil,
|
||||
"nth": nil,
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue