Priority: Major - P3
Affects Version/s: None
Fix Version/s: Backlog
When two $setWindowFields stages appear in a row, it may be beneficial to combine them into one stage.
For example, this query:
has the same result as this one:
After desugaring and dropping a redundant $sort (
SERVER-55464), the original query is:
I think a valid set of criteria for combining the two _internalSetWindowFields stages would be:
- The second stage does not read from any 'output' field of the first.
- The two stages don't have any 'output' field name in common.
- The two stages have identical partitionBy and sortBy arguments.