Class AggregateProjectPullUpConstantsRule
- java.lang.Object
-
- org.apache.calcite.plan.RelOptRule
-
- org.apache.calcite.rel.rules.AggregateProjectPullUpConstantsRule
-
public class AggregateProjectPullUpConstantsRule extends RelOptRule
Planner rule that removes constant keys from anAggregate
.Constant fields are deduced using
RelMetadataQuery.getPulledUpPredicates(RelNode)
; the input does not need to be aProject
.This rules never removes the last column, because
Aggregate([])
returns 1 row even if its input is empty.Since the transformed relational expression has to match the original relational expression, the constants are placed in a projection above the reduced aggregate. If those constants are not used, another rule will remove them from the project.
-
-
Field Summary
Fields Modifier and Type Field Description static AggregateProjectPullUpConstantsRule
INSTANCE
The singleton.static AggregateProjectPullUpConstantsRule
INSTANCE2
More general instance that matches any relational expression.-
Fields inherited from class org.apache.calcite.plan.RelOptRule
description, operands, relBuilderFactory
-
-
Constructor Summary
Constructors Constructor Description AggregateProjectPullUpConstantsRule(java.lang.Class<? extends Aggregate> aggregateClass, java.lang.Class<? extends RelNode> inputClass, RelBuilderFactory relBuilderFactory, java.lang.String description)
Creates an AggregateProjectPullUpConstantsRule.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
onMatch(RelOptRuleCall call)
Receives notification about a rule match.-
Methods inherited from class org.apache.calcite.plan.RelOptRule
any, convert, convert, convertList, convertOperand, convertOperand, equals, equals, getOperand, getOperands, getOutConvention, getOutTrait, hashCode, matches, none, operand, operand, operand, operand, operand, operandJ, operandJ, some, toString, unordered
-
-
-
-
Field Detail
-
INSTANCE
public static final AggregateProjectPullUpConstantsRule INSTANCE
The singleton.
-
INSTANCE2
public static final AggregateProjectPullUpConstantsRule INSTANCE2
More general instance that matches any relational expression.
-
-
Constructor Detail
-
AggregateProjectPullUpConstantsRule
public AggregateProjectPullUpConstantsRule(java.lang.Class<? extends Aggregate> aggregateClass, java.lang.Class<? extends RelNode> inputClass, RelBuilderFactory relBuilderFactory, java.lang.String description)
Creates an AggregateProjectPullUpConstantsRule.- Parameters:
aggregateClass
- Aggregate classinputClass
- Input class, such asLogicalProject
relBuilderFactory
- Builder for relational expressionsdescription
- Description, or null to guess description
-
-
Method Detail
-
onMatch
public void onMatch(RelOptRuleCall call)
Description copied from class:RelOptRule
Receives notification about a rule match. At the time that this method is called,call.rels
holds the set of relational expressions which match the operands to the rule;call.rels[0]
is the root expression.Typically a rule would check that the nodes are valid matches, creates a new expression, then calls back
RelOptRuleCall.transformTo(org.apache.calcite.rel.RelNode, java.util.Map<org.apache.calcite.rel.RelNode, org.apache.calcite.rel.RelNode>)
to register the expression.- Specified by:
onMatch
in classRelOptRule
- Parameters:
call
- Rule call- See Also:
RelOptRule.matches(RelOptRuleCall)
-
-