fix integer bug on less than queries.

this was introduced recently to fix another bug. the comment above it
is correct, just the logic was off-by-one. The test shows the issue
and was confirmed to reproduce it and then fix it.
This commit is contained in:
Matt Jaffee 2019-11-10 12:00:24 -06:00
parent 7401fd1333
commit 0fec16a141
No known key found for this signature in database
GPG key ID: 08A3DFFF987B11BF
2 changed files with 18 additions and 1 deletions

View file

@ -1175,7 +1175,8 @@ func (f *fragment) rangeLTUnsigned(filter *Row, bitDepth uint, predicate uint64,
// if the predicate is larger than all representable numbers given
// our bitDepth... then just return everything.
if msb(predicate) >= bitDepth {
if msb(predicate) > bitDepth {
return filter, nil
}

View file

@ -3243,6 +3243,22 @@ func TestFragmentPositionsForValue(t *testing.T) {
}
}
func TestIntLTRegression(t *testing.T) {
f := mustOpenFragment("i", "f", "v", 0, CacheTypeNone)
defer f.Clean(t)
f.setValue(1, 6, 33)
row, err := f.rangeOp(pql.LT, 6, 33)
if err != nil {
t.Fatalf("doing range of: %v", err)
}
if !row.IsEmpty() {
t.Errorf("expected nothing, but got: %v", row.Columns())
}
}
func TestImportClearRestart(t *testing.T) {
tests := []struct {
rows []uint64