File tree Expand file tree Collapse file tree 2 files changed +9
-13
lines changed
Expand file tree Collapse file tree 2 files changed +9
-13
lines changed Original file line number Diff line number Diff line change @@ -118,15 +118,7 @@ func (o *Or) eval(vecs ...vector.Any) vector.Any {
118118 if _ , ok := rhs .(* vector.Error ); ok {
119119 return o .orError (rhs , lhs )
120120 }
121- blhs , brhs := toBool (lhs ), toBool (rhs )
122- bits := bitvec .Or (blhs .Bits , brhs .Bits )
123- if blhs .Nulls .IsZero () && brhs .Nulls .IsZero () {
124- // Fast path involves no nulls.
125- return vector .NewBool (bits , bitvec .Zero )
126- }
127- nulls := bitvec .Or (blhs .Nulls , brhs .Nulls )
128- nulls = bitvec .And (bitvec .Not (bits ), nulls )
129- return vector .NewBool (bits , nulls )
121+ return vector .Or (toBool (lhs ), toBool (rhs ))
130122}
131123
132124func (o * Or ) orError (err , vec vector.Any ) vector.Any {
Original file line number Diff line number Diff line change @@ -51,11 +51,15 @@ func (b *Bool) Serialize(builder *scode.Builder, slot uint32) {
5151 }
5252}
5353
54- // Or is a simple case of logical-or where we don't care about nulls in
55- // the input (presuming the corresponding bits to be false) and we return
56- // the or'd result as a boolean vector without nulls.
5754func Or (a , b * Bool ) * Bool {
58- return NewBool (bitvec .Or (a .Bits , b .Bits ), bitvec .Zero )
55+ bits := bitvec .Or (a .Bits , b .Bits )
56+ if a .Nulls .IsZero () && b .Nulls .IsZero () {
57+ // Fast path involves no nulls.
58+ return NewBool (bits , bitvec .Zero )
59+ }
60+ nulls := bitvec .Or (a .Nulls , b .Nulls )
61+ nulls = bitvec .And (bitvec .Not (bits ), nulls )
62+ return NewBool (bits , nulls )
5963}
6064
6165// BoolValue returns the value of slot in vec if the value is a Boolean. It
You can’t perform that action at this time.
0 commit comments