fix container key computation for UnionRows call

This commit is contained in:
Matthew Jaffee 2022-06-19 15:36:08 -05:00 committed by Matthew Jaffee
parent 97c84da566
commit bfa59ffdc4
2 changed files with 10 additions and 2 deletions

View file

@ -338,12 +338,11 @@ func (f *BitmapRowsUnion) ConsiderData(key FilterKey, data *Container) FilterRes
// if necessary (because we expect the results to correspond to our shard
// ID).
func (f *BitmapRowsUnion) Results(shard uint64) *Bitmap {
shard <<= shardwidth.Exponent
b := NewSliceBitmap()
for i, c := range f.c {
// UnionInPlace might not have fixed count
c.Repair()
b.Containers.Put(uint64(i)+shard, c)
b.Containers.Put(uint64(i)+shard*rowWidth, c)
}
return b
}

View file

@ -125,6 +125,15 @@ func TestRowsUnion(t *testing.T) {
}
out := u.Results(0)
compareSlices(t, "sevenEleven", out.Slice(), expected)
// regression check (FB-1497)... make sure we're getting the
// expected bits in a higher shard as well
expected2 := make([]uint64, len(expected))
for i, exp := range expected {
expected2[i] = exp + 2*1<<shardwidth.Exponent
}
out2 := u.Results(2)
compareSlices(t, "sevenEleven2", out2.Slice(), expected2)
}
func TestBitmapFilter(t *testing.T) {