[SERVER-81448] $replaceRoot over $project fails in TS queries lowered to SBE Created: 26/Sep/23  Updated: 29/Oct/23  Resolved: 09/Oct/23

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

Type: Bug 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

Issue Links:
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

run mongod with "--setParameter featureFlagTimeSeriesInSbe=true --setParameter featureFlagSbeFull=true"
ts is a time-series collection, it's not important whether timeField, metaField or measurement fields are used in the pipeline, as long as the two fields are different.

db.ts.explain().aggregate([{$project: {c: 1}},{$replaceRoot: {newRoot: {z: "$b"}}}])

result:
"errmsg" : "Expected build() for UNPACK_TS_BUCKET to either produce a kResult slot or to satisfy all kField reqs",
"code" : 6023424,

Sprint: QI 2023-10-16
Participants:
Linked BF Score: 151

 Description   

The first $project stage from the repro pipeline is absorbed into the bucket unpacking stage which, as a result, would only produce slots for "_id" and "c" fields and for kResult, if requested by parent. The $project stage would request a kResult but the $replaceRoot stage doesn't and instead requests a slot for "b", which hasn't been produced.



 Comments   
Comment by Githook User [ 07/Oct/23 ]

Author:

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

Message: SERVER-81448 time-series unpack stage in SBE should publish all fields from reqs
Branch: master
https://github.com/mongodb/mongo/commit/14e34bb033d76f883f0cf7c7c10e1a27e8f97ad0

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