public class AggregateReduceFunctionsRule
extends org.apache.calcite.plan.RelOptRule
Aggregate
s to simpler forms.
Rewrites:
Since many of these rewrites introduce multiple occurrences of simpler
forms like COUNT(x)
, the rule gathers common sub-expressions as it
goes.
Modifier and Type | Field and Description |
---|---|
static AggregateReduceFunctionsRule |
INSTANCE
The singleton.
|
Constructor and Description |
---|
AggregateReduceFunctionsRule(org.apache.calcite.plan.RelOptRuleOperand operand,
org.apache.calcite.tools.RelBuilderFactory relBuilderFactory)
Creates an AggregateReduceFunctionsRule.
|
Modifier and Type | Method and Description |
---|---|
boolean |
matches(org.apache.calcite.plan.RelOptRuleCall call) |
protected void |
newAggregateRel(org.apache.calcite.tools.RelBuilder relBuilder,
org.apache.calcite.rel.core.Aggregate oldAggregate,
List<org.apache.calcite.rel.core.AggregateCall> newCalls)
Do a shallow clone of oldAggRel and update aggCalls.
|
protected void |
newCalcRel(org.apache.calcite.tools.RelBuilder relBuilder,
org.apache.calcite.rel.core.Aggregate oldAggregate,
List<org.apache.calcite.rex.RexNode> exprs)
Add a calc with the expressions to compute the original agg calls from the
decomposed ones.
|
void |
onMatch(org.apache.calcite.plan.RelOptRuleCall ruleCall) |
public static final AggregateReduceFunctionsRule INSTANCE
public AggregateReduceFunctionsRule(org.apache.calcite.plan.RelOptRuleOperand operand, org.apache.calcite.tools.RelBuilderFactory relBuilderFactory)
public boolean matches(org.apache.calcite.plan.RelOptRuleCall call)
matches
in class org.apache.calcite.plan.RelOptRule
public void onMatch(org.apache.calcite.plan.RelOptRuleCall ruleCall)
onMatch
in class org.apache.calcite.plan.RelOptRule
protected void newAggregateRel(org.apache.calcite.tools.RelBuilder relBuilder, org.apache.calcite.rel.core.Aggregate oldAggregate, List<org.apache.calcite.rel.core.AggregateCall> newCalls)
relBuilder
- Builder of relational expressions; at the top of its
stack is its inputoldAggregate
- LogicalAggregate to clone.newCalls
- New list of AggregateCallsprotected void newCalcRel(org.apache.calcite.tools.RelBuilder relBuilder, org.apache.calcite.rel.core.Aggregate oldAggregate, List<org.apache.calcite.rex.RexNode> exprs)
relBuilder
- Builder of relational expressions; at the top of its
stack is its inputoldAggregate
- The original LogicalAggregate that is replaced.exprs
- The expressions to compute the original agg calls.Copyright © 2014–2019 The Apache Software Foundation. All rights reserved.