mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 09:05:55 +00:00
Fix GroupBy Distinct aggregate on int field
This commit is contained in:
parent
55fad52c59
commit
83ce30f1c4
2 changed files with 15 additions and 1 deletions
|
|
@ -2829,7 +2829,12 @@ func (e *executor) executeGroupBy(ctx context.Context, qcx *Qcx, index string, c
|
|||
for n, gc := range results {
|
||||
intersectRows := make([]*pql.Call, 0, len(gc.Group))
|
||||
for _, fr := range gc.Group {
|
||||
intersectRows = append(intersectRows, &pql.Call{Name: "Row", Args: map[string]interface{}{fr.Field: fr.RowID}})
|
||||
var value interface{} = fr.RowID
|
||||
// use fr.Value instead of fr.RowID if set (from int fields)
|
||||
if fr.Value != nil {
|
||||
value = &pql.Condition{Op: pql.EQ, Value: *fr.Value}
|
||||
}
|
||||
intersectRows = append(intersectRows, &pql.Call{Name: "Row", Args: map[string]interface{}{fr.Field: value}})
|
||||
}
|
||||
// apply any filter, if present
|
||||
if filter != nil {
|
||||
|
|
|
|||
|
|
@ -7108,6 +7108,15 @@ toucan,1,10000
|
|||
csvVerifier: `toucan,1,10000
|
||||
zebra,1,1000
|
||||
pangolin,1,100
|
||||
`,
|
||||
},
|
||||
{
|
||||
query: "GroupBy(Rows(field=affinity), aggregate=Count(Distinct(field=zip_code)))",
|
||||
csvVerifier: `-10,1,1
|
||||
-5,1,1
|
||||
0,1,1
|
||||
5,1,1
|
||||
10,1,1
|
||||
`,
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue