mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-06 19:07:50 +00:00
Make sure that outOfRange field predicates return not-null for NEQ queries
This commit is contained in:
parent
d62ea053b5
commit
b0afec0761
2 changed files with 13 additions and 1 deletions
|
|
@ -794,7 +794,7 @@ func (e *Executor) executeFieldRangeSlice(ctx context.Context, index string, c *
|
|||
}
|
||||
|
||||
baseValue, outOfRange := field.BaseValue(cond.Op, value)
|
||||
if outOfRange {
|
||||
if outOfRange && cond.Op != pql.NEQ {
|
||||
return NewBitmap(), nil
|
||||
}
|
||||
|
||||
|
|
@ -804,6 +804,11 @@ func (e *Executor) executeFieldRangeSlice(ctx context.Context, index string, c *
|
|||
return NewBitmap(), nil
|
||||
}
|
||||
|
||||
// outOfRange for NEQ should return all not-null.
|
||||
if outOfRange && cond.Op == pql.NEQ {
|
||||
return frag.FieldNotNull(field.BitDepth())
|
||||
}
|
||||
|
||||
f.Stats.Count("range:field", 1, 1.0)
|
||||
return frag.FieldRange(cond.Op, field.BitDepth(), baseValue)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -777,6 +777,13 @@ func TestExecutor_Execute_FieldRange(t *testing.T) {
|
|||
} else if !reflect.DeepEqual([]uint64{SliceWidth, SliceWidth + 1, SliceWidth + 2}, result[0].(*pilosa.Bitmap).Bits()) {
|
||||
t.Fatalf("unexpected result: %s", spew.Sdump(result))
|
||||
}
|
||||
// NEQ -<int>
|
||||
if result, err := e.Execute(context.Background(), "i", test.MustParse(`Range(frame=other, foo != -20)`), nil, nil); err != nil {
|
||||
t.Fatal(err)
|
||||
} else if !reflect.DeepEqual([]uint64{0}, result[0].(*pilosa.Bitmap).Bits()) {
|
||||
//t.Fatalf("unexpected result: %s", spew.Sdump(result))
|
||||
t.Fatalf("unexpected result: %s", result[0].(*pilosa.Bitmap).Bits())
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("LT", func(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue