Class DecorrelateLeftUnnestWithGlobalAggregation
java.lang.Object
io.trino.sql.planner.iterative.rule.DecorrelateLeftUnnestWithGlobalAggregation
- All Implemented Interfaces:
Rule<CorrelatedJoinNode>
public class DecorrelateLeftUnnestWithGlobalAggregation
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 LEFT 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 invalid input: '<'- agg1(x)
- Projection
x invalid input: '<'- foo(y)
- Aggregation
group by (g)
y invalid input: '<'- agg2(u)
- Unnest LEFT
g invalid input: '<'- unnest(c1)
u invalid input: '<'- unnest(c2)
replicate: ()
Into:
- Projection (restrict outputs)
- Aggregation
group by (a, c1, c2, unique)
agg invalid input: '<'- agg1(x)
- Projection
x invalid input: '<'- foo(y)
- Aggregation
group by (g, a, c1, c2, unique)
y invalid input: '<'- agg2(u)
- Unnest LEFT
g invalid input: '<'- unnest(c1)
u invalid input: '<'- 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 -
Method Summary
Modifier and TypeMethodDescriptionapply(CorrelatedJoinNode correlatedJoinNode, Captures captures, Rule.Context context) Returns a pattern to which plan nodes this rule applies.
-
Constructor Details
-
DecorrelateLeftUnnestWithGlobalAggregation
public DecorrelateLeftUnnestWithGlobalAggregation()
-
-
Method Details
-
getPattern
Description copied from interface:RuleReturns a pattern to which plan nodes this rule applies.- Specified by:
getPatternin interfaceRule<CorrelatedJoinNode>
-