mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-11 23:31:03 +00:00
GroupBy should terminate even if the last result is empty
If you have two criteria, and the last result you generate is empty, the nextAtIdx iterator for i==1 will try to continue poking the i==0 iterator. That one produces a nil result, and declares the entire group-by iterator done... But the nextAtIdx call above it isn't checking that, and just loops forever. This causes some queries to become stuck permanently, consuming ridiculous amounts of resources almost entirely focused on calling Intersect millions of times to get empty results.
This commit is contained in:
parent
398ce117ec
commit
3a7ab3b8eb
1 changed files with 3 additions and 0 deletions
|
|
@ -4665,6 +4665,9 @@ func (gbi *groupByIterator) nextAtIdx(i int) {
|
|||
}
|
||||
if wrapped && i != 0 {
|
||||
gbi.nextAtIdx(i - 1)
|
||||
if gbi.done {
|
||||
return
|
||||
}
|
||||
}
|
||||
if i == 0 && gbi.filter != nil {
|
||||
gbi.rows[i].row = nr.Intersect(gbi.filter)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue