[SERVER-60300] Support pushdown of sugared $group stages Created: 29/Sep/21  Updated: 29/Oct/23  Resolved: 11/Jan/22

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

Type: Task Priority: Major - P3
Reporter: Yoon Soo Kim Assignee: Anna Wawrzyniak
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-62401 Support pushdown of $bucketAuto stage... Backlog
is related to SERVER-60226 Ban sugared $group stages from being ... Closed
Backwards Compatibility: Fully Compatible
Sprint: QE 2021-10-18, QE 2021-12-27, QE 2022-01-10, QE 2022-01-24
Participants:

 Description   

In SERVER-60226, we blocked sugared $group stages such as $bucket/$bucketAuto/$sortByCount from being pushed down to SBE because $coerceToBool is not supported in SBE and those sugared $group stages may be translated to $group stages with a $coerceToBool expression.

As soon as we implement $coerceToBool, we should be able to support those stages for pushdown to SBE.



 Comments   
Comment by Githook User [ 07/Jan/22 ]

Author:

{'name': 'Anna Wawrzyniak', 'email': 'anna.wawrzyniak@mongodb.com', 'username': 'anna-wawrzyniak'}

Message: SERVER-60300 Enable pushdown of $bucket and $sortByCount to SBE
Branch: master
https://github.com/mongodb/mongo/commit/d2410ba51043c227ee26374ff34bab697134ba2a

Comment by Anna Wawrzyniak [ 06/Jan/22 ]

$bucket and $sortByCount are desugared in DocumentSource createFromBson into group and sort, and they automatically work with SBE after just marking them as sbeCompatible. However $autoBucket is different.
DocumentSourceBucketAuto is a real document source independent from DocumentSourceGroup. Based on the documentation here https://docs.mongodb.com/manual/reference/operator/aggregation/bucketAuto/ is looks like the _ids are generated based on the entire set rather than per document.  Since $autoBucket automatically chooses ranges based on the input set of values I don’t think it can use SBE HashAggStage or any hash-based aggregation and would require its own dedicated SBE stage if we were to push it down. Created https://jira.mongodb.org/browse/SERVER-62401 to track that work, as that is out of scope of $group pushdown work.

Generated at Thu Feb 08 05:49:27 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.