org.eigenbase.rel.convert
Class ConverterRelImpl

java.lang.Object
  extended by org.eigenbase.rel.AbstractRelNode
      extended by org.eigenbase.rel.SingleRel
          extended by org.eigenbase.rel.convert.ConverterRelImpl
All Implemented Interfaces:
Cloneable, ConverterRel, RelNode
Direct Known Subclasses:
AbstractConverter, FennelToIteratorConverter, IteratorToFennelConverter, NoneConverterRel, ResultSetToFarragoIteratorConverter, VolcanoPlannerTest.PhysToIteratorConverter, VolcanoPlannerTraitTest.AltTraitConverter, VolcanoPlannerTraitTest.PhysToIteratorConverter

public abstract class ConverterRelImpl
extends SingleRel
implements ConverterRel

Abstract implementation of ConverterRel.

Version:
$Id: //open/dev/farrago/src/org/eigenbase/rel/convert/ConverterRelImpl.java#5 $
Author:
jhyde

Field Summary
protected  RelTraitSet inTraits
           
protected  RelTraitDef traitDef
           
 
Fields inherited from class org.eigenbase.rel.AbstractRelNode
digest, id, rowType, traits
 
Fields inherited from interface org.eigenbase.rel.RelNode
emptyArray
 
Constructor Summary
protected ConverterRelImpl(RelOptCluster cluster, RelTraitDef traitDef, RelTraitSet traits, RelNode child)
          Creates a ConverterRelImpl.
 
Method Summary
protected  Error cannotImplement()
           
 RelOptCost computeSelfCost(RelOptPlanner planner)
          Returns the cost of this plan (not including children).
protected static RelTraitSet convertTraits(RelTraitSet traits, RelTrait trait)
          Returns a new trait set based on traits, with a different trait for a given type of trait.
protected  CallingConvention getInputConvention()
           
 RelTraitSet getInputTraits()
          Returns the trait of the input relational expression.
 RelTraitDef getTraitDef()
          Returns the definition of trait which this converter works on.
 boolean isDistinct()
          Returns whether the same value will not come out twice.
 
Methods inherited from class org.eigenbase.rel.SingleRel
childrenAccept, deriveRowType, explain, getChild, getInputs, getRows, replaceInput
 
Methods inherited from class org.eigenbase.rel.AbstractRelNode
clone, cloneTraits, collectVariablesSet, collectVariablesUsed, computeDigest, getChildExps, getCluster, getCollationList, getConvention, getCorrelVariable, getDescription, getDigest, getExpectedInputRowType, getId, getInput, getOrCreateCorrelVariable, getQuery, getRelTypeName, getRowType, getTable, getTraits, getVariablesStopped, inheritTraitsFrom, isAccessTo, isValid, onRegister, recomputeDigest, register, registerCorrelVariable, setCorrelVariable, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eigenbase.rel.convert.ConverterRel
getChild
 
Methods inherited from interface org.eigenbase.rel.RelNode
childrenAccept, clone, collectVariablesSet, collectVariablesUsed, explain, getChildExps, getCluster, getCollationList, getConvention, getCorrelVariable, getDescription, getDigest, getExpectedInputRowType, getId, getInput, getInputs, getOrCreateCorrelVariable, getQuery, getRelTypeName, getRows, getRowType, getTable, getTraits, getVariablesStopped, isAccessTo, isValid, onRegister, recomputeDigest, registerCorrelVariable, replaceInput, setCorrelVariable
 

Field Detail

inTraits

protected RelTraitSet inTraits

traitDef

protected final RelTraitDef traitDef
Constructor Detail

ConverterRelImpl

protected ConverterRelImpl(RelOptCluster cluster,
                           RelTraitDef traitDef,
                           RelTraitSet traits,
                           RelNode child)
Creates a ConverterRelImpl.

Parameters:
cluster - planner's cluster
traitDef - the RelTraitDef this converter converts
traits - the output traits of this converter
child - child rel (provides input traits)
Method Detail

computeSelfCost

public RelOptCost computeSelfCost(RelOptPlanner planner)
Description copied from interface: RelNode
Returns the cost of this plan (not including children). The base implementation throws an error; derived classes should override.

NOTE jvs 29-Mar-2006: Don't call this method directly. Instead, use RelMetadataQuery.getNonCumulativeCost(org.eigenbase.rel.RelNode), which gives plugins a chance to override the rel's default ideas about cost.

Specified by:
computeSelfCost in interface RelNode
Overrides:
computeSelfCost in class AbstractRelNode

cannotImplement

protected Error cannotImplement()

isDistinct

public boolean isDistinct()
Description copied from interface: RelNode
Returns whether the same value will not come out twice. Default value is false, derived classes should override.

Specified by:
isDistinct in interface RelNode
Overrides:
isDistinct in class AbstractRelNode

getInputConvention

protected CallingConvention getInputConvention()

getInputTraits

public RelTraitSet getInputTraits()
Description copied from interface: ConverterRel
Returns the trait of the input relational expression.

Specified by:
getInputTraits in interface ConverterRel
Returns:
input trait

getTraitDef

public RelTraitDef getTraitDef()
Description copied from interface: ConverterRel
Returns the definition of trait which this converter works on.

The input relational expression (matched by the rule) must possess this trait and have the value given by ConverterRel.getInputTraits(), and the traits of the output of this converter given by RelNode.getTraits() will have one trait altered and the other orthogonal traits will be the same.

Specified by:
getTraitDef in interface ConverterRel
Returns:
trait which this converter modifies

convertTraits

protected static RelTraitSet convertTraits(RelTraitSet traits,
                                           RelTrait trait)
Returns a new trait set based on traits, with a different trait for a given type of trait. Clones traits, and then replaces the existing trait matching trait.getTraitDef() with trait.

Parameters:
traits - the set of traits to convert
trait - the converted trait
Returns:
a new RelTraitSet