org.eigenbase.rel.convert
Class ConverterRule

java.lang.Object
  extended by org.eigenbase.relopt.RelOptRule
      extended by org.eigenbase.rel.convert.ConverterRule
Direct Known Subclasses:
FactoryConverterRule, FennelCalcRule, FennelEmptyRule, FennelOneRowRule, FennelUnionRule, FennelValuesRule, IteratorToFennelConverter.IteratorToFennelPullRule, IterRules.IterCalcRule, IterRules.OneRowToIteratorRule, IterRules.UnionToIteratorRule, VolcanoPlannerTraitTest.AltTraitConverterRule, VolcanoPlannerTraitTest.PhysToIteratorConverterRule

public abstract class ConverterRule
extends RelOptRule

Abstract base class for a rule which converts from one calling convention to another without changing semantics.

Since:
May 5, 2003
Version:
$Id: //open/dev/farrago/src/org/eigenbase/rel/convert/ConverterRule.java#16 $
Author:
jhyde

Nested Class Summary
private static class ConverterRule.ConverterRelOptRuleOperand
           
 
Field Summary
private  RelTrait inTrait
           
private  RelTrait outTrait
           
 
Fields inherited from class org.eigenbase.relopt.RelOptRule
ANY, description, operands
 
Constructor Summary
ConverterRule(Class clazz, RelTrait in, RelTrait out, String description)
          Creates a ConverterRule.
 
Method Summary
abstract  RelNode convert(RelNode rel)
           
 RelTrait getInTrait()
           
 CallingConvention getOutConvention()
          Returns the calling 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.eigenbase.relopt.RelOptRule
convert, equals, equals, getOperand, getOperands, hashCode, matches, mergeTraitsAndConvert, mergeTraitsAndConvert, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

inTrait

private final RelTrait inTrait

outTrait

private final RelTrait outTrait
Constructor Detail

ConverterRule

public ConverterRule(Class clazz,
                     RelTrait in,
                     RelTrait out,
                     String description)
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
description - Description of rule
"Precondition:"
in != null, out != null
Method Detail

getOutConvention

public CallingConvention getOutConvention()
Description copied from class: RelOptRule
Returns the calling convention of the result of firing this rule, null if not known.

Overrides:
getOutConvention in class RelOptRule

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

getInTrait

public RelTrait getInTrait()

getTraitDef

public RelTraitDef getTraitDef()

convert

public abstract RelNode convert(RelNode rel)

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.


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.eigenbase.rel.RelNode) to register the expression.

Specified by:
onMatch in class RelOptRule
Parameters:
call - Rule call
See Also:
RelOptRule.matches(RelOptRuleCall)