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

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Won't Do
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Optimization
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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:
            [DO NOT USE] Backlog - Query Optimization
            Reporter:
            David Percy (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: