[SERVER-81197] SBE project stage requires the child stage to materialize the result Created: 19/Sep/23  Updated: 20/Sep/23

Status: Backlog
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

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

Assigned Teams:
Query Execution
Participants:

 Description   

In the SBE plans we've recently started generating for time series, if there is $project that does `buildProjectionDefault()` it would require the child stage to produce the kResult slot. It means the plan would look like:

db.ts.explain().aggregate([{$match: {c: 42}},{$project: {_id: 0, b: 1}}]).queryPlanner.winningPlan.slotBasedPlan.stages // "b" is meta field and "c" is a measurement field
 
[3] project [s8 = makeBsonObj(MakeObjSpec(["b"], Closed, ReturnNothing), s7)]
[2] mkbson s7 [c = s6, b = s4] true false
[2] filter {traverseF(s6, lambda(l101.0) { ((move(l101.0) == 42L) ?: false) }, false)}
[2] block_to_row blocks[s5] row[s6]
[2] ts_bucket_to_cellblock s2 pathReqs[s5 = Get(c)/Id] s4 = meta
...

Because a kResult slot is requested, we finish bucket unpacking with a materializing mkbson stage, only to pass it to the project stage which will rematerialize a subset of the fields.


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