Package org.apache.calcite.rel.convert
Class ConverterRule
- Direct Known Subclasses:
ArrowRules.ArrowProjectRule
,Bindables.BindableAggregateRule
,Bindables.BindableFilterRule
,Bindables.BindableJoinRule
,Bindables.BindableMatchRule
,Bindables.BindableProjectRule
,Bindables.BindableSetOpRule
,Bindables.BindableSortRule
,Bindables.BindableValuesRule
,Bindables.BindableWindowRule
,CassandraRules.CassandraProjectRule
,CassandraToEnumerableConverterRule
,ElasticsearchToEnumerableConverterRule
,EnumerableBindable.EnumerableToBindableConverterRule
,EnumerableCorrelateRule
,EnumerableInterpreterRule
,EnumerableMatchRule
,EnumerableRepeatUnionRule
,EnumerableTableFunctionScanRule
,EnumerableTableModifyRule
,EnumerableTableScanRule
,EnumerableTableSpoolRule
,EnumerableValuesRule
,GeodeToEnumerableConverterRule
,InnodbRules.InnodbProjectRule
,InnodbToEnumerableConverterRule
,JdbcRules.JdbcAggregateRule
,JdbcRules.JdbcFilterRule
,JdbcRules.JdbcIntersectRule
,JdbcRules.JdbcJoinRule
,JdbcRules.JdbcMinusRule
,JdbcRules.JdbcProjectRule
,JdbcRules.JdbcSortRule
,JdbcRules.JdbcTableModificationRule
,JdbcRules.JdbcUnionRule
,JdbcRules.JdbcValuesRule
,JdbcToEnumerableConverterRule
,JdbcToSparkConverterRule
,MongoToEnumerableConverterRule
,NoneToBindableConverterRule
,PigToEnumerableConverterRule
,SparkRules.SparkValuesRule
Abstract base class for a rule which converts from one calling convention to
another without changing semantics.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.calcite.plan.RelRule
RelRule.Done, RelRule.MatchHandler<R extends RelOptRule>, RelRule.OperandBuilder, RelRule.OperandDetailBuilder<R extends RelNode>, RelRule.OperandTransform
Nested classes/interfaces inherited from class org.apache.calcite.plan.RelOptRule
RelOptRule.ConverterRelOptRuleOperand
-
Field Summary
Fields inherited from class org.apache.calcite.plan.RelOptRule
description, operands, relBuilderFactory
-
Constructor Summary
ModifierConstructorDescriptionprotected
Deprecated.protected
ConverterRule
(Class<R> clazz, com.google.common.base.Predicate<? super R> predicate, RelTrait in, RelTrait out, String descriptionPrefix) Deprecated.protected
ConverterRule
(Class<R> clazz, com.google.common.base.Predicate<? super R> predicate, RelTrait in, RelTrait out, RelBuilderFactory relBuilderFactory, String description) Deprecated.protected
ConverterRule
(Class<R> clazz, Predicate<? super R> predicate, RelTrait in, RelTrait out, RelBuilderFactory relBuilderFactory, String descriptionPrefix) Deprecated.protected
ConverterRule
(ConverterRule.Config config) Creates aConverterRule
. -
Method Summary
Modifier and TypeMethodDescriptionabstract @Nullable RelNode
Converts a relational expression to the target trait(s) of this rule.Returns the convention of the result of firing this rule, null if not known.Returns the trait which will be modified as a result of firing this rule, or null if the rule is not a converter rule.boolean
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, convert, convert, convertList, convertOperand, convertOperand, equals, equals, getOperand, getOperands, hashCode, matches, none, operand, operand, operand, operand, operand, operandJ, operandJ, some, toString, unordered
-
Field Details
-
out
-
-
Constructor Details
-
ConverterRule
Creates aConverterRule
. -
ConverterRule
@Deprecated protected ConverterRule(Class<? extends RelNode> clazz, RelTrait in, RelTrait out, String descriptionPrefix) Deprecated.Creates aConverterRule
.- Parameters:
clazz
- Type of relational expression to consider convertingin
- Trait of relational expression to consider convertingout
- Trait which is converted todescriptionPrefix
- Description prefix of rule
-
ConverterRule
@Deprecated protected ConverterRule(Class<R> clazz, com.google.common.base.Predicate<? super R> predicate, RelTrait in, RelTrait out, String descriptionPrefix) Deprecated. -
ConverterRule
@Deprecated protected ConverterRule(Class<R> clazz, Predicate<? super R> predicate, RelTrait in, RelTrait out, RelBuilderFactory relBuilderFactory, String descriptionPrefix) Deprecated.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 expressionsdescriptionPrefix
- Description prefix of rule
-
ConverterRule
@Deprecated protected ConverterRule(Class<R> clazz, com.google.common.base.Predicate<? super R> predicate, RelTrait in, RelTrait out, RelBuilderFactory relBuilderFactory, String description) Deprecated.
-
-
Method Details
-
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
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
-
getTraitDef
-
convert
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
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>, org.apache.calcite.plan.RelHintsPropagator)
to register the expression.- Specified by:
onMatch
in classRelOptRule
- Parameters:
call
- Rule call- See Also:
-
ConverterRule(Config)