[SERVER-70224] [CQF] Add rewrite to push not through EvalFilter when possible Created: 05/Oct/22  Updated: 29/Oct/23  Resolved: 22/Nov/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.3.0-rc0

Type: Task Priority: Major - P3
Reporter: Hana Pearlman Assignee: David Percy
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-70089 CE for neq Closed
Related
related to SERVER-69591 [CQF] Simplify non-sargable paths Closed
Backwards Compatibility: Fully Compatible
Sprint: QO 2022-11-14, QO 2022-11-28
Participants:

 Description   

This rewrite would push a UnaryOp[not] through an EvalFilter under certain conditions. For example UnaryOp[not] EvalFilter PathCompare[eq] Constant[2] --> EvalFilter PathCompare[neq] Constant[2]

This is not always correct when the path below the EvalFilter contains a Traverse. For example, the following rewrite is not correct: 
UnaryOp[not] EvalFilter PathGet["a] PathTraverse[1] PathCompare[eq] Constant[2] --> EvalFilter PathGet["a] PathTraverse[1] PathCompare[neq] Constant[2]

This would have incorrect behavior for arrays at path "a".



 Comments   
Comment by Githook User [ 22/Nov/22 ]

Author:

{'name': 'David Percy', 'email': 'david.percy@mongodb.com', 'username': 'dpercy'}

Message: SERVER-70224 [CQF] Pushdown Not through EvalFilter

Before converting a Filter to Sargable node, try to push down UnaryOp
Not through PathGet. Ideally we can push it all the way down and
incorporate it into a leaf PathCompare: for example Not ... Lt -> Gte.
Branch: master
https://github.com/mongodb/mongo/commit/e125b7eece0854f35571e0def28061a721407c38

Comment by David Percy [ 08/Nov/22 ]

Never mind, I think we're going to split this after all.

Comment by David Percy [ 07/Nov/22 ]

I ended up doing this together with SERVER-69591 (still in review).

Generated at Thu Feb 08 06:15:37 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.