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

[CQF] Test all plans for a single MQL query

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

      Let's try the following:

      • Create a new C++ unit test in a new file, with similar dependencies as sbe_abt_test.cpp.
      • Write a single example:
        • query in MQL
        • input documents
        • index specs
      • Translate the query to ABT
      • Get the query results as naively as possible. For example:
        • Disable constant folding
        • Disable exploration rewrites
        • Use a ScanDef with no indexes
      • Generate all query plans:
        • Leave constant folding, exploration, everything else enabled.
        • Disable branch and bound.
        • Keep rejected plans.
        • Run OptPhaseManager once.
        • Write a new function that extracts all plans from the final memo.
      • Lower to SBE, and run, each plan.
      • Compare each result to the naive result.
        • Use sorting to ignore both field order, and document order.

      In other words, this is a property test that holds the query and input data fixed, and asserts: all plans for this query are correct. This means optimization bugs can't hide behind costing decisions. But we still have control over which examples we test.

       

      This will also be a good opportunity to test cost predictions.

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

              Created:
              Updated: