[SERVER-81611] [CQF] ConstEval should not assume (Eq x x) is True Created: 02/Oct/23  Updated: 03/Oct/23

Status: Backlog
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: David Percy Assignee: Backlog - Query Optimization
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Query Optimization
Participants:

 Description   

ConstEval makes this assumption:

                // If the subtrees are equal, we can conclude that their result is equal because we
                // have only pure functions.
                swapAndUpdate(n, Constant::boolean(true));

https://github.com/10gen/mongo/blob/7bfc9ed61e60b841c107f947bb173d75db261437/src/mongo/db/query/optimizer/rewrites/const_eval.cpp#L361-L363

But it looks like both Instruction::eq and Instruction::cmp3way propagate Nothing, so (Eq x x) may be either True or Nothing.


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