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

CE unit test infrastructure with in-flight CE recording

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

      Implement a unit test infrastructure that allows to capture the cardinality estimate of a tested expression during query optimization.

      The current (before this task) way of unit testing CE follows the following 
      approach: * get an ABT for a query using translatePipeline

      • create a phaseManager either with MemoSubstitutionPhase or both {MemoSubstitutionPhase, MemoExplorationPhase}
      • run the optimizer on the ABT from step 1 and get an optimized ABT
      • call deriveCE on this optimized ABT
      • there are also some tests calling CE against manually constructed ABTs.

      The idea with optimizing either with MemoSubstitutionPhase or both {MemoSubstitutionPhase, MemoExplorationPhase} is to get either "raw" FilterNodes, or get their corresponding SargableNodes (in the second case).

      This approach is "unrealistic" because it doesn't test the estimation of ABTs in their actual form as estimated by the optimizer. With this approach comparison expressions are represented either as FilterNode (and PathCompare subtrees), or as nodes where all LogicalMemoDelegator nodes are substituted with the actual nodes they point to.

      However, during optimization the structure of the nodes is such that child nodes are often delegator nodes that indirectly reference their children in other memo groups.

       

      This task should allow us to unit test expressions in the form used during query optimization. The test infrastructure could intercept the call to deriveCE() in 
      Memo::estimateCE(), and record it "somewhere" in a way suitable for extraction by the unit test.

            Assignee:
            backlog-query-optimization [DO NOT USE] Backlog - Query Optimization
            Reporter:
            timour.katchaounov@mongodb.com Timour Katchaounov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: