Class DecorrelateInnerUnnestWithGlobalAggregation
- java.lang.Object
-
- io.trino.sql.planner.iterative.rule.DecorrelateInnerUnnestWithGlobalAggregation
-
- All Implemented Interfaces:
Rule<CorrelatedJoinNode>
public class DecorrelateInnerUnnestWithGlobalAggregation extends Object implements Rule<CorrelatedJoinNode>
This rule finds correlated UnnestNode in CorrelatedJoinNode's subquery and folds them into UnnestNode representing LEFT JOIN UNNEST. This rule transforms plans, where: - UnnestNode in subquery is based only on correlation symbols - UnnestNode in subquery is INNER without filter - subquery contains global aggregation over the result of unnest Additionally, other global aggregations, grouped aggregations and projections in subquery are supported.Transforms:
- CorrelatedJoin (LEFT or INNER) on true, correlation(c1, c2) - Input (a, c1, c2) - Aggregation global grouping agg <- agg1(x) - Projection x <- foo(y) - Aggregation group by (g) y <- agg2(u) - Unnest INNER g <- unnest(c1) u <- unnest(c2) replicate: ()Into:- Projection (restrict outputs) - Aggregation group by (a, c1, c2, unique) agg <- agg1(x) mask(mask_symbol) - Projection x <- foo(y) - Aggregation group by (g, a, c1, c2, unique, mask_symbol) y <- agg2(u) - Projection mask_symbol <- ordinality IS NOT NULL - Unnest LEFT with ordinality g <- unnest(c1) u <- unnest(c2) replicate: (a, c1, c2, unique) - AssignUniqueId unique - Input (a, c1, c2)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.trino.sql.planner.iterative.Rule
Rule.Context, Rule.Result
-
-
Constructor Summary
Constructors Constructor Description DecorrelateInnerUnnestWithGlobalAggregation()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Rule.Resultapply(CorrelatedJoinNode correlatedJoinNode, Captures captures, Rule.Context context)Pattern<CorrelatedJoinNode>getPattern()Returns a pattern to which plan nodes this rule applies.
-
-
-
Method Detail
-
getPattern
public Pattern<CorrelatedJoinNode> getPattern()
Description copied from interface:RuleReturns a pattern to which plan nodes this rule applies.- Specified by:
getPatternin interfaceRule<CorrelatedJoinNode>
-
apply
public Rule.Result apply(CorrelatedJoinNode correlatedJoinNode, Captures captures, Rule.Context context)
- Specified by:
applyin interfaceRule<CorrelatedJoinNode>
-
-