Include into the rowStoreExpr only the output fields

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Fixed
    • Priority: Major - P3
    • 6.2.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • QE 2022-09-19, QE 2022-10-03
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      Currently, the rowStoreExpr in SlotBasedStageBuilder::buildColumnScan includes all fields, even those that are pushed down as per-path filters and don't participate in the output.

      This might affect correctness in some corner cases:
      [
      {$match: {x: {$lt: 42}}}, // will be lowered as a per-path filter
      {$project: {_id: 1}}, // "x" should not be included into the output, but currently rowStoreExpr will keep it
      {$group: {_id: "$x", s: {$sum: 1}},
      ]
      The result of the group would depend on whether "x" is included into the output or not. Currently we inject mkbson stage on top of column_scan that would remove "x" but as we are cleaning up the CSI plans and removing the unnecessary stages, the extra field from the rowStoreExpr might leak through. 

      Also, the simpler the expr the better it is for perf.

            Assignee:
            Irina Yatsenko (Inactive)
            Reporter:
            Irina Yatsenko (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: