Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-81611

[CQF] ConstEval should not assume (Eq x x) is True

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Query Optimization

      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.

            Assignee:
            backlog-query-optimization [DO NOT USE] Backlog - Query Optimization
            Reporter:
            david.percy@mongodb.com David Percy
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: