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

[CQF] jstests/cqf/optimizer/sort_merge.js fails with parameterization enabled

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Query Optimization
    • ALL
    • QO 2023-11-13, QO 2023-11-27

      This test fails when parameterization is enabled with a tassert that the optimizer fails to generate a plan.

      The query isĀ 

      find({a: {$in: [1, 2, 3]}}).sort({_id: 1}).hint({a: 1})

      The predicate is translated as

      PathGet [a]
      PathTraverse [1]
      PathCompare [EqMember]
      FunctionCall [getParam]
      |  Const [15] // type of array
      Const [0] // parameter ID

      When we try to convert this ABT to PartialSchemaRequirements, we fail because we only support building bounds for EqMember when the operand is a Constant.

      This results in us failing to convert this filter to a SargableNode, which is necessary for the optimizer to ever emit an ixscan plan. With the hint, we disable collscan plans, so we fail to generate a plan.

            Assignee:
            backlog-query-optimization [DO NOT USE] Backlog - Query Optimization
            Reporter:
            ben.shteinfeld@mongodb.com Ben Shteinfeld
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: