-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Execution
-
Fully Compatible
-
ALL
-
CAR Team 2024-02-19
If we have three documents in a single bucket,
{a: 1, b: 1} {a: 2, b: 0} {a: 1, b: 3}and a pipeline with a $match for a: 1
followed by a $addFields: that adds 5 to b
followed by a $match for b < 7
The result should contain just the
{a: 1, b: 1} document because the second has been excluded by the first $match, and the third one by the second $match (3+5 is not less than 7)
Right now I think the first mask is used inside the second $match, but the comparison operator ignores it because it's faster to just process all the data instead of checking the bitmask one by one.
The SlotBasedStageBuilder::buildVectorizedFilterExpr should take care of creating an AND between the existing bitmask and the result that is going to overwrite the kBlockSelectivityBitmap slot in order to preserve it. Maybe with a coerceToBool on its arguments to ensure that the bitmask is always made by booleans