Package org.apache.calcite.rel.convert
Class ConverterRule
- java.lang.Object
-
- org.apache.calcite.plan.RelOptRule
-
- org.apache.calcite.rel.convert.ConverterRule
-
- Direct Known Subclasses:
Bindables.BindableAggregateRule
,Bindables.BindableFilterRule
,Bindables.BindableJoinRule
,Bindables.BindableProjectRule
,Bindables.BindableSortRule
,Bindables.BindableUnionRule
,Bindables.BindableValuesRule
,Bindables.BindableWindowRule
,CassandraRules.CassandraConverterRule
,CassandraToEnumerableConverterRule
,ElasticsearchRules.ElasticsearchConverterRule
,ElasticsearchToEnumerableConverterRule
,EnumerableAggregateRule
,EnumerableBindable.EnumerableToBindableConverterRule
,EnumerableCalcRule
,EnumerableCollectRule
,EnumerableCorrelateRule
,EnumerableFilterRule
,EnumerableInterpreterRule
,EnumerableIntersectRule
,EnumerableJoinRule
,EnumerableMergeJoinRule
,EnumerableMinusRule
,EnumerableProjectRule
,EnumerableSemiJoinRule
,EnumerableSortRule
,EnumerableTableFunctionScanRule
,EnumerableTableModifyRule
,EnumerableTableScanRule
,EnumerableToSparkConverterRule
,EnumerableUncollectRule
,EnumerableUnionRule
,EnumerableValuesRule
,EnumerableWindowRule
,GeodeRules.GeodeConverterRule
,GeodeToEnumerableConverterRule
,JdbcRules.JdbcConverterRule
,JdbcToEnumerableConverterRule
,JdbcToSparkConverterRule
,MongoRules.MongoConverterRule
,MongoToEnumerableConverterRule
,NoneToBindableConverterRule
,PigRules.PigAggregateRule
,PigRules.PigFilterRule
,PigRules.PigJoinRule
,PigRules.PigProjectRule
,PigRules.PigTableScanRule
,PigToEnumerableConverterRule
,SparkRules.EnumerableToSparkConverterRule
,SparkRules.SparkCalcRule
,SparkRules.SparkToEnumerableConverterRule
,SparkRules.SparkValuesRule
public abstract class ConverterRule extends RelOptRule
Abstract base class for a rule which converts from one calling convention to another without changing semantics.
-
-
Field Summary
Fields Modifier and Type Field Description private RelTrait
inTrait
private RelTrait
outTrait
-
Fields inherited from class org.apache.calcite.plan.RelOptRule
description, operands, relBuilderFactory
-
-
Constructor Summary
Constructors Constructor Description ConverterRule(java.lang.Class<? extends RelNode> clazz, RelTrait in, RelTrait out, java.lang.String description)
Creates aConverterRule
.ConverterRule(java.lang.Class<R> clazz, com.google.common.base.Predicate<? super R> predicate, RelTrait in, RelTrait out, java.lang.String description)
Deprecated.ConverterRule(java.lang.Class<R> clazz, com.google.common.base.Predicate<? super R> predicate, RelTrait in, RelTrait out, RelBuilderFactory relBuilderFactory, java.lang.String description)
Deprecated.ConverterRule(java.lang.Class<R> clazz, java.util.function.Predicate<? super R> predicate, RelTrait in, RelTrait out, RelBuilderFactory relBuilderFactory, java.lang.String description)
Creates aConverterRule
with a predicate.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract RelNode
convert(RelNode rel)
Converts a relational expression to the target trait(s) of this rule.RelTrait
getInTrait()
Convention
getOutConvention()
Returns the convention of the result of firing this rule, null if not known.RelTrait
getOutTrait()
Returns the trait which will be modified as a result of firing this rule, or null if the rule is not a converter rule.RelTraitDef
getTraitDef()
boolean
isGuaranteed()
Returns true if this rule can convert any relational expression of the input convention.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, hashCode, matches, none, operand, operand, operand, operand, operand, operandJ, operandJ, some, toString, unordered
-
-
-
-
Constructor Detail
-
ConverterRule
public ConverterRule(java.lang.Class<? extends RelNode> clazz, RelTrait in, RelTrait out, java.lang.String description)
Creates aConverterRule
.- Parameters:
clazz
- Type of relational expression to consider convertingin
- Trait of relational expression to consider convertingout
- Trait which is converted todescription
- Description of rule
-
ConverterRule
@Deprecated public ConverterRule(java.lang.Class<R> clazz, com.google.common.base.Predicate<? super R> predicate, RelTrait in, RelTrait out, java.lang.String description)
Deprecated.
-
ConverterRule
public ConverterRule(java.lang.Class<R> clazz, java.util.function.Predicate<? super R> predicate, RelTrait in, RelTrait out, RelBuilderFactory relBuilderFactory, java.lang.String description)
Creates aConverterRule
with a predicate.- Parameters:
clazz
- Type of relational expression to consider convertingpredicate
- Predicate on the relational expressionin
- Trait of relational expression to consider convertingout
- Trait which is converted torelBuilderFactory
- Builder for relational expressionsdescription
- Description of rule
-
ConverterRule
@Deprecated public ConverterRule(java.lang.Class<R> clazz, com.google.common.base.Predicate<? super R> predicate, RelTrait in, RelTrait out, RelBuilderFactory relBuilderFactory, java.lang.String description)
Deprecated.
-
-
Method Detail
-
getOutConvention
public Convention getOutConvention()
Description copied from class:RelOptRule
Returns the convention of the result of firing this rule, null if not known.- Overrides:
getOutConvention
in classRelOptRule
- Returns:
- Convention of the result of firing this rule, null if not known
-
getOutTrait
public RelTrait getOutTrait()
Description copied from class:RelOptRule
Returns the trait which will be modified as a result of firing this rule, or null if the rule is not a converter rule.- Overrides:
getOutTrait
in classRelOptRule
- Returns:
- Trait which will be modified as a result of firing this rule, or null if the rule is not a converter rule
-
getInTrait
public RelTrait getInTrait()
-
getTraitDef
public RelTraitDef getTraitDef()
-
convert
public abstract RelNode convert(RelNode rel)
Converts a relational expression to the target trait(s) of this rule.Returns null if conversion is not possible.
-
isGuaranteed
public boolean isGuaranteed()
Returns true if this rule can convert any relational expression of the input convention.The union-to-java converter, for example, is not guaranteed, because it only works on unions.
- Returns:
true
if this rule can convert any relational expression
-
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)
-
-