org.eigenbase.rel
Class CorrelatorRel

java.lang.Object
  extended by org.eigenbase.rel.AbstractRelNode
      extended by org.eigenbase.rel.JoinRelBase
          extended by org.eigenbase.rel.CorrelatorRel
All Implemented Interfaces:
Cloneable, RelNode

public final class CorrelatorRel
extends JoinRelBase

A CorrelatorRel behaves like a kind of JoinRel, but works by setting variables in its environment and restarting its right-hand input.

A CorrelatorRel is used to represent a correlated query. One implementation strategy is to de-correlate the expression.

Since:
23 September, 2001
Version:
$Id: //open/dev/farrago/src/org/eigenbase/rel/CorrelatorRel.java#19 $
Author:
jhyde

Nested Class Summary
static class CorrelatorRel.Correlation
          Describes the neccessary parameters for an implementation in order to identify and set dynamic variables
 
Field Summary
protected  List<CorrelatorRel.Correlation> correlations
           
 
Fields inherited from class org.eigenbase.rel.JoinRelBase
condition, joinType, left, right, variablesStopped
 
Fields inherited from class org.eigenbase.rel.AbstractRelNode
digest, id, nextId, rowType, traits
 
Fields inherited from interface org.eigenbase.rel.RelNode
emptyArray
 
Constructor Summary
CorrelatorRel(RelOptCluster cluster, RelNode left, RelNode right, List<CorrelatorRel.Correlation> correlations, JoinRelType joinType)
          Creates a CorrelatorRel with no join condition.
CorrelatorRel(RelOptCluster cluster, RelNode left, RelNode right, RexNode joinCond, List<CorrelatorRel.Correlation> correlations, JoinRelType joinType)
          Creates a CorrelatorRel.
 
Method Summary
 CorrelatorRel clone()
          Clones this RelNode.
protected  RelDataType deriveRowType()
           
 void explain(RelOptPlanWriter pw)
           
 List<CorrelatorRel.Correlation> getCorrelations()
          Returns the correlating expressions.
 
Methods inherited from class org.eigenbase.rel.JoinRelBase
_isValid, childrenAccept, computeSelfCost, createJoinType, deriveJoinRowType, estimateJoinedRows, getChildExps, getCondition, getInputs, getJoinType, getLeft, getRight, getRows, getSystemFieldList, getVariablesStopped, registerStoppedVariable, replaceInput, setVariablesStopped
 
Methods inherited from class org.eigenbase.rel.AbstractRelNode
cloneTraits, collectVariablesSet, collectVariablesUsed, computeDigest, getCluster, getCollationList, getConvention, getCorrelVariable, getDescription, getDigest, getExpectedInputRowType, getId, getInput, getOrCreateCorrelVariable, getQuery, getRelTypeName, getRowType, getTable, getTraits, inheritTraitsFrom, isAccessTo, isDistinct, isValid, onRegister, recomputeDigest, register, registerCorrelVariable, setCorrelVariable, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

correlations

protected final List<CorrelatorRel.Correlation> correlations
Constructor Detail

CorrelatorRel

public CorrelatorRel(RelOptCluster cluster,
                     RelNode left,
                     RelNode right,
                     RexNode joinCond,
                     List<CorrelatorRel.Correlation> correlations,
                     JoinRelType joinType)
Creates a CorrelatorRel.

Parameters:
cluster - cluster this relational expression belongs to
left - left input relational expression
right - right input relational expression
joinCond - join condition
correlations - set of expressions to set as variables each time a row arrives from the left input
joinType - join type

CorrelatorRel

public CorrelatorRel(RelOptCluster cluster,
                     RelNode left,
                     RelNode right,
                     List<CorrelatorRel.Correlation> correlations,
                     JoinRelType joinType)
Creates a CorrelatorRel with no join condition.

Parameters:
cluster - cluster this relational expression belongs to
left - left input relational expression
right - right input relational expression
correlations - set of expressions to set as variables each time a row arrives from the left input
joinType - join type
Method Detail

clone

public CorrelatorRel clone()
Description copied from interface: RelNode
Clones this RelNode.

Traits of the RelNode must be explicitly cloned, using AbstractRelNode.inheritTraitsFrom(AbstractRelNode), as the RelNode may have traits of which it has no knowledge. Example implementation:

     public MyRelNode clone()
     {
         MyRelNode clone = new MyRelNode(...);
         clone.inheritTraitsFrom(this);
         return clone;
     }
 
N.B.: This method must be overridden whenever an existing, concrete RelNode is extended. Otherwise, calling clone() will produce a differently typed RelNode, resulting in invalid or incorrect query plans.

Specified by:
clone in interface RelNode
Specified by:
clone in class AbstractRelNode
Returns:
a clone of this RelNode

deriveRowType

protected RelDataType deriveRowType()
Overrides:
deriveRowType in class JoinRelBase

explain

public void explain(RelOptPlanWriter pw)
Specified by:
explain in interface RelNode
Overrides:
explain in class JoinRelBase

getCorrelations

public List<CorrelatorRel.Correlation> getCorrelations()
Returns the correlating expressions.

Returns:
correlating expressions