Class PreAggregateCaseAggregations
java.lang.Object
io.trino.sql.planner.iterative.rule.PreAggregateCaseAggregations
- All Implemented Interfaces:
Rule<AggregationNode>
Rule that transforms selected aggregations from:
- Aggregation[key]: sum(aggr1), sum(aggr2), ..., sum(aggrN)
- Project:
aggr1 = CASE WHEN col=1 THEN expr ELSE 0
aggr2 = CASE WHEN col=2 THEN expr ELSE null
...
aggrN = CASE WHEN col=N THEN expr
- source
into:
- Aggregation[key]: sum(aggr1), sum(aggr2), ..., sum(aggrN)
- Project:
aggr1 = CASE WHEN col=1 THEN pre_aggregate
aggr2 = CASE WHEN col=2 THEN pre_aggregate
..
aggrN = CASE WHEN col=N THEN pre_aggregate
- Aggregation[key, col]: pre_aggregate = sum(expr)
- source
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.trino.sql.planner.iterative.Rule
Rule.Context, Rule.Result -
Constructor Summary
ConstructorsConstructorDescriptionPreAggregateCaseAggregations(PlannerContext plannerContext, IrTypeAnalyzer typeAnalyzer) -
Method Summary
Modifier and TypeMethodDescriptionapply(AggregationNode aggregationNode, Captures captures, Rule.Context context) Returns a pattern to which plan nodes this rule applies.boolean
-
Constructor Details
-
PreAggregateCaseAggregations
-
-
Method Details
-
getPattern
Description copied from interface:RuleReturns a pattern to which plan nodes this rule applies.- Specified by:
getPatternin interfaceRule<AggregationNode>
-
isEnabled
- Specified by:
isEnabledin interfaceRule<AggregationNode>
-
apply
- Specified by:
applyin interfaceRule<AggregationNode>
-