-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not extract distinct operator when de-correlating global aggregation
Before this change, rules `TestTransformCorrelatedGlobalAggregationWithoutProjection` and `TestTransformCorrelatedGlobalAggregationWithProjection` extracted and handled two aggregations in the correlated subquery: - a global aggregation - a "distinct operator" - i.e. an aggregation with grouping symbols but without any aggregate functions It is a common case that such two aggregations are present. They result from a call like: `count(distinct x)` Before this change, if both aggregations were present in the subquery, the rules would move them both on top of the de-correlated join. This behavior was suboptimal in some cases, specifically when the "distinct operator" could be de-correlated in place. Moving the "distinct operator" on top of the join blocked other optimizations, e.g. `PushAggregationThroughOuterJoin`. After this change, the "distinct operator" is moved on top of the de-correlated join only if it can't be de-correlated in the subquery.
- Loading branch information
Showing
5 changed files
with
150 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters