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

[CQF] Share the implementation of Filter decomposition rewrite

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • Query Optimization
    • Fully Compatible

      SERVER-70812 implemented an optimization at the end of ABT translation for find which decomposes an EvalFilter with a conjunction in a serial chain of Filter nodes for consistency with the agg codepath. This is helpful to perform before PathFusion in order to simplify the plan. There is already a similar rewrite implemented in the substitution phase this rewrite performs the filter decomposition described above with the following differences:

      1. It performs the decomposition one node at a time and relies on the RewriteContext's hasSubstituted bit to decide whether to do another pass, rather than perform the full decomposition at once. This makes it less obvious of how to share the optimization code between the two locations.
      2. It extracts the common path prefix. It is unclear to me whether this should be done in the translation version of this optimization.

      The current state is not great, we need this optimization before PathFusion and during the substitution phase, and as a resultĀ  duplicate the code as the implementations are slightly different. This ticket tracks work to improve this situation; either refactor the code optimizations to be implemented in a shared file (handling the differences described above), or introduce a new phase done before PathFusion and remove the optimization as part of translation.

            Assignee:
            svilen.mihaylov@mongodb.com Svilen Mihaylov (Inactive)
            Reporter:
            ben.shteinfeld@mongodb.com Ben Shteinfeld
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: