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

@Enclosing public abstract class ConverterRule extends RelRule<ConverterRule.Config>
Abstract base class for a rule which converts from one calling convention to another without changing semantics.
  • Field Details

  • Constructor Details

    • ConverterRule

      protected ConverterRule(ConverterRule.Config config)
      Creates a ConverterRule.
    • ConverterRule

      @Deprecated protected ConverterRule(Class<? extends RelNode> clazz, RelTrait in, RelTrait out, String descriptionPrefix)
      Deprecated.
      Creates a ConverterRule.
      Parameters:
      clazz - Type of relational expression to consider converting
      in - Trait of relational expression to consider converting
      out - Trait which is converted to
      descriptionPrefix - 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 a ConverterRule with a predicate.
      Parameters:
      clazz - Type of relational expression to consider converting
      predicate - Predicate on the relational expression
      in - Trait of relational expression to consider converting
      out - Trait which is converted to
      relBuilderFactory - Builder for relational expressions
      descriptionPrefix - 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

      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 class RelOptRule
      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 class RelOptRule
      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 @Nullable 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>, org.apache.calcite.plan.RelHintsPropagator) to register the expression.

      Specified by:
      onMatch in class RelOptRule
      Parameters:
      call - Rule call
      See Also: