[SERVER-77574] Relax the sorting requirement for enabling streaming group on timeseries aggregations. Created: 30/May/23  Updated: 03/Feb/24

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

Type: Improvement Priority: Major - P3
Reporter: Davis Haupt (Inactive) Assignee: Backlog - Query Integration
Resolution: Unresolved Votes: 0
Labels: qi-timeseries
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-75508 Optimize streaming $group Backlog
Assigned Teams:
Query Integration
Participants:

 Description   

Currently, streaming $group is only enabled when the user provides a $sort stage on the _id field of the $group. Most accumulators do not have different outputs depending on the order of the input documents.

When the $group doesn't depend on the ordering of input documents and the group stage groups on time, we can insert a $sort stage to reorder documents and enable streaming $group.

As part of this ticket,
1. Investigate which accumulators do depend on document ordering (at least $firstN and $lastN)
2. Add code to DocumentSourceInternalUnpackBucket::doOptimizeAt() directly before the call to enableStreamingGroupIfPossible() that will insert a $sort stage on the timeField before the new streaming group stage.


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