Class TransformCorrelatedGlobalAggregationWithProjection
- java.lang.Object
-
- io.prestosql.sql.planner.iterative.rule.TransformCorrelatedGlobalAggregationWithProjection
-
- All Implemented Interfaces:
Rule<CorrelatedJoinNode>
public class TransformCorrelatedGlobalAggregationWithProjection extends Object implements Rule<CorrelatedJoinNode>
This rule decorrelates a correlated subquery of LEFT or INNER correlated join with: - single global aggregation, or - global aggregation over distinct operator (grouped aggregation with no aggregation assignments)In the case of single aggregation, it transforms:
- CorrelatedJoin LEFT or INNER (correlation: [c], filter: true, output: a, x, y) - Input (a, c) - Project (x <- f(count), y <- f'(agg)) - Aggregation global count <- count(*) agg <- agg(b) - Source (b) with correlated filter (b > c)
Into:- Project (a <- a, x <- f(count), y <- f'(agg)) - Aggregation (group by [a, c, unique]) count <- count(*) mask(non_null) agg <- agg(b) mask(non_null) - LEFT join (filter: b > c) - UniqueId (unique) - Input (a, c) - Project (non_null <- TRUE) - Source (b) decorrelated
In the case of global aggregation over distinct operator, it transforms:
- CorrelatedJoin LEFT or INNER (correlation: [c], filter: true, output: a, x, y) - Input (a, c) - Project (x <- f(count), y <- f'(agg)) - Aggregation global count <- count(*) agg <- agg(b) - Aggregation "distinct operator" group by [b] - Source (b) with correlated filter (b > c)
Into:- Project (a <- a, x <- f(count), y <- f'(agg)) - Aggregation (group by [a, c, unique]) count <- count(*) mask(non_null) agg <- agg(b) mask(non_null) - Aggregation "distinct operator" group by [a, c, unique, non_null, b] - LEFT join (filter: b > c) - UniqueId (unique) - Input (a, c) - Project (non_null <- TRUE) - Source (b) decorrelated
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.prestosql.sql.planner.iterative.Rule
Rule.Context, Rule.Result
-
-
Constructor Summary
Constructors Constructor Description TransformCorrelatedGlobalAggregationWithProjection(Metadata metadata)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Rule.Result
apply(CorrelatedJoinNode correlatedJoinNode, Captures captures, Rule.Context context)
Pattern<CorrelatedJoinNode>
getPattern()
Returns a pattern to which plan nodes this rule applies.
-
-
-
Constructor Detail
-
TransformCorrelatedGlobalAggregationWithProjection
public TransformCorrelatedGlobalAggregationWithProjection(Metadata metadata)
-
-
Method Detail
-
getPattern
public Pattern<CorrelatedJoinNode> getPattern()
Description copied from interface:Rule
Returns a pattern to which plan nodes this rule applies.- Specified by:
getPattern
in interfaceRule<CorrelatedJoinNode>
-
apply
public Rule.Result apply(CorrelatedJoinNode correlatedJoinNode, Captures captures, Rule.Context context)
- Specified by:
apply
in interfaceRule<CorrelatedJoinNode>
-
-