fix BSI comparison match-all-but-one operation

This commit is contained in:
Jaden Weiss 2020-06-10 09:23:39 -04:00
parent 058ed747c7
commit d478dd9d94
No known key found for this signature in database
GPG key ID: 177F065773634B67

View file

@ -1270,12 +1270,12 @@ func (f *fragment) rangeLTUnsigned(filter *Row, bitDepth uint, predicate uint64,
return filter, nil
case predicate == (1<<bitDepth)-1 && !allowEquality:
// This query matches everything that is not (1<<bitDepth)-1.
remaining := filter
for i := uint(0); i < bitDepth && remaining.Any(); i++ {
matches := NewRow()
for i := uint(0); i < bitDepth; i++ {
row := f.row(uint64(bsiOffsetBit + i))
remaining = remaining.Intersect(row)
matches = matches.Union(filter.Difference(row))
}
return remaining, nil
return matches, nil
case allowEquality:
predicate++
}
@ -1345,12 +1345,12 @@ func (f *fragment) rangeGTUnsigned(filter *Row, bitDepth uint, predicate uint64,
return filter, nil
case predicate == 0 && !allowEquality:
// This query matches everything that is not 0.
remaining := filter
for i := uint(0); i < bitDepth && remaining.Any(); i++ {
matches := NewRow()
for i := uint(0); i < bitDepth; i++ {
row := f.row(uint64(bsiOffsetBit + i))
remaining = remaining.Difference(row)
matches = matches.Union(filter.Intersect(row))
}
return remaining, nil
return matches, nil
case allowEquality:
predicate--
}