mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-12 15:51:01 +00:00
add GroupBy(Rows(column)) test and fix comments
This commit is contained in:
parent
fb706ab883
commit
38f459a6d4
2 changed files with 15 additions and 5 deletions
|
|
@ -839,9 +839,10 @@ func (e *executor) executeGroupBy(ctx context.Context, index string, c *pql.Call
|
|||
limit = int(lim)
|
||||
}
|
||||
|
||||
// perform Rows queries - TODO, call async? run per shard in
|
||||
// executeGroupByShard? (note: can only do this for Rows queries which do
|
||||
// not include "column" arg)
|
||||
// perform necessary Rows queries (any that have limit or columns args) -
|
||||
// TODO, call async? would only help if multiple Rows queries had a column
|
||||
// or limit arg.
|
||||
// TODO support TopN in here would be really cool - and pretty easy I think.
|
||||
childRows := make([]RowIDs, len(c.Children))
|
||||
for i, child := range c.Children {
|
||||
if child.Name != "Rows" {
|
||||
|
|
|
|||
|
|
@ -2518,6 +2518,17 @@ func TestExecutor_Execute_GroupBy(t *testing.T) {
|
|||
checkGroupBy(t, expected, results)
|
||||
})
|
||||
|
||||
t.Run("distinct rows in different shards with column arg", func(t *testing.T) {
|
||||
results := c.Query(t, "i", fmt.Sprintf(`GroupBy(Rows(field=ma), Rows(field=mb, column=%d), limit=5)`, ShardWidth)).Results[0].([]pilosa.GroupCount)
|
||||
expected := []pilosa.GroupCount{
|
||||
{Group: []pilosa.FieldRow{{Field: "ma", RowID: 1}, {Field: "mb", RowID: 1}}, Count: 1},
|
||||
{Group: []pilosa.FieldRow{{Field: "ma", RowID: 1}, {Field: "mb", RowID: 3}}, Count: 1},
|
||||
{Group: []pilosa.FieldRow{{Field: "ma", RowID: 3}, {Field: "mb", RowID: 1}}, Count: 1},
|
||||
{Group: []pilosa.FieldRow{{Field: "ma", RowID: 3}, {Field: "mb", RowID: 3}}, Count: 1},
|
||||
}
|
||||
checkGroupBy(t, expected, results)
|
||||
})
|
||||
|
||||
c.CreateField(t, "i", pilosa.IndexOptions{}, "na")
|
||||
c.CreateField(t, "i", pilosa.IndexOptions{}, "nb")
|
||||
c.ImportBits(t, "i", "na", [][2]uint64{
|
||||
|
|
@ -2544,8 +2555,6 @@ func TestExecutor_Execute_GroupBy(t *testing.T) {
|
|||
|
||||
})
|
||||
|
||||
// TODO test column queries to row call (also with multiple shards)
|
||||
|
||||
// test paging over results using previous. set the same bits in three
|
||||
// fields
|
||||
c.CreateField(t, "i", pilosa.IndexOptions{}, "ppa")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue