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

Refactor run_aggregate with a AggregationPlan class

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

      run_aggregate.cpp provides the high-level runAggregate functionality, which delegates to a handful of helper functions. As we've been slowly splitting the file into more helper functions, the throughline of the main run_aggregate path has become clearer and more intelligible to engineers; however, each helper function has a list of up to 13 parameters.

      We recently added a ParsedFindCommand struct that tracks the metadata of a find command. We should add a AggregationPlan class that wraps the aggregate request, BSON cmdObj, lite parsed pipeline, requestedNss, and executionNss. Those are the primary elements of the run aggregate path that are used through each stage of the file, so this structure will (1) more clearly differentiate which variables are central through the entire process of aggregation versus one step along the way and (2) reduce the friction necessary to delegate runAggregate into more helper functions.

            Assignee:
            joseph.shalabi@mongodb.com Joe Shalabi
            Reporter:
            will.buerger@mongodb.com Will Buerger
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: