[M1 - Search Extension] Fix $lookup and $unionWith to invoke lowerToExecutable() for $_documentResultsAndMetadata in sub-pipelines

XMLWordPrintableJSON

    • Query Integration
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Overview

      Fix $lookup and $unionWith to call lowerToExecutable() on $_documentResultsAndMetadata when it appears at the front of their sub-pipelines.

      Background

      run_agg.cpp's prepareExecutorsForPipeline only lowers $_documentResultsAndMetadata at the top-level pipeline. $lookup and $unionWith defer sub-pipeline preparation until doGetNext() at execution time, so the top-level lowering pass never recurses into them. If $search appears inside a $unionWith or $lookup sub-pipeline, the container will sit unexpanded when the sub-pipeline first executes.

      Scope of Work

      In DocumentSourceLookup::doGetNext() and DocumentSourceUnionWith::doGetNext(), before the sub-pipeline is first executed, check whether its front stage is a DocumentSourceDocumentResultsAndMetadata and if so call lowerToExecutable() on it

      Acceptance Criteria

      • $search inside a $unionWith sub-pipeline executes correctly with scoped $$SEARCH_META
      • \$search inside a $lookup sub-pipeline executes correctly
      • Outer $$SEARCH_META is not affected by inner-scope lowering
      • Test coverage for $search-in-$unionWith and $search-in-$lookup

            Assignee:
            Unassigned
            Reporter:
            Daniel Segel
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: