[SERVER-83427] [CQF] Improve constant folding for And/Or with a constant RHS if LHS is guaranteed to not return Nothing Created: 17/Nov/23 Updated: 24/Jan/24 Resolved: 04/Jan/24 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 7.3.0-rc0 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Ben Shteinfeld | Assignee: | Lynne Wang |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Assigned Teams: |
Query Optimization
|
||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||
| Sprint: | QO 2023-11-27, QO 2023-12-11, QO 2023-12-25, QO 2024-01-08 | ||||||||||||
| Participants: | |||||||||||||
| Description |
|
Currently our constant folding implementation will ignore AND(..., false) and OR(..., true) in order to respect SBE's short circuiting semantics. This is because the LHS will evaluate to either a boolean or Nothing. In the case that the LHS evaluates to Nothing, SBE will not evaluate the RHS. That is why our constant folding cannot fold these expressions. Interval simplification generates expressions that look like this, but we can prove that LHS will never return nothing, since there are no field accesses on the LHS, there are only constants, getParam() invocations, or BinaryOps. This ticket is to improve constant folding to keep track of the Nothingness of expressions and make use of it in the case of AND/OR with a constant RHS. |
| Comments |
| Comment by Githook User [ 21/Dec/23 ] |
|
Author: {'name': 'Lynne Wang', 'email': 'lynne.wang@mongodb.com', 'username': 'lynne-wang'}Message: GitOrigin-RevId: 49d0d677074e51f7a43a67d664269034ca170d67 |