[SERVER-69350] Include into the rowStoreExpr only the output fields Created: 31/Aug/22  Updated: 29/Oct/23  Resolved: 20/Sep/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.2.0-rc0

Type: Task Priority: Major - P3
Reporter: Irina Yatsenko (Inactive) Assignee: Irina Yatsenko (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: QE 2022-09-19, QE 2022-10-03
Participants:

 Description   

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.



 Comments   
Comment by Githook User [ 20/Sep/22 ]

Author:

{'name': 'Irina Yatsenko', 'email': 'irina.yatsenko@mongodb.com', 'username': 'IrinaYatsenko'}

Message: SERVER-69350 Only project output fields on fall back to the row store
Branch: master
https://github.com/mongodb/mongo/commit/6c2f7a0a6bd5a24f08a44bef8972117c7dd4e9a4

Generated at Thu Feb 08 06:13:14 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.