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

Simplify generated SBE expressions when some arguments are constants

    XMLWordPrintable

Details

    • Improvement
    • Status: Open
    • Major - P3
    • Resolution: Unresolved
    • None
    • None
    • Querying
    • Query Execution 2021-05-03, Query Execution 2021-05-17, Query Execution 2021-05-31, Query Execution 2021-06-14, Query Execution 2021-06-28, Query Execution 2021-07-12, Query Execution 2021-07-26

    Description

      When we translate MQL expressions in SBE, some arguments for these expressions can be constants. In this case we can statically perform all necessary checks on the constant arguments during the stage building phase, rather than doing it in runtime. This should greatly simplify generated SBE expressions. For example, here is an expressions generated for $split: ["$a", " "]:

       

      project [s12 = let [l1.0 = s11, l1.1 = " "] if (! exists (l1.1) || typeMatch (l1.1, 0x00000440), null, if (! isString (l1.1), fail ( 5155400 ,$split delimiter must be a string), if (l1.1 == "", fail ( 5155401 ,$split delimiter must not be an empty string), if (! exists (l1.0) || typeMatch (l1.0, 0x00000440), null, if (! isString (l1.0), fail ( 5155402 ,$split string expression must be a string), if (l1.0 == "", [""], split (l1.0, l1.1)))))))]

      Note all the checks around slot l1.1 - they're totally redundant.

      We need to analyze all expressions in the SBE expression stage builder and optimize them to perform compile time checks for constant arguments.

       

      Attachments

        Issue Links

          Activity

            People

              backlog-query-execution Backlog - Query Execution
              anton.korshunov@mongodb.com Anton Korshunov
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated: