org.eigenbase.rel.rules
Class MultiJoinRel

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

public final class MultiJoinRel
extends AbstractRelNode

A MultiJoinRel represents a join of N inputs, whereas other join relnodes represent strictly binary joins.

Version:
$Id: //open/dev/farrago/src/org/eigenbase/rel/rules/MultiJoinRel.java#13 $
Author:
Zelaine Fong

Field Summary
private  RelNode[] inputs
           
private  boolean isFullOuterJoin
           
private  Map<Integer,int[]> joinFieldRefCountsMap
           
private  RexNode joinFilter
           
private  JoinRelType[] joinTypes
           
private  RexNode[] outerJoinConditions
           
private  RexNode postJoinFilter
           
private  BitSet[] projFields
           
private  RelDataType rowType
           
 
Fields inherited from class org.eigenbase.rel.AbstractRelNode
digest, id, traits
 
Fields inherited from interface org.eigenbase.rel.RelNode
emptyArray
 
Constructor Summary
MultiJoinRel(RelOptCluster cluster, RelNode[] inputs, RexNode joinFilter, RelDataType rowType, boolean isFullOuterJoin, RexNode[] outerJoinConditions, JoinRelType[] joinTypes, BitSet[] projFields, Map<Integer,int[]> joinFieldRefCountsMap)
           
MultiJoinRel(RelOptCluster cluster, RelNode[] inputs, RexNode joinFilter, RelDataType rowType, boolean isFullOuterJoin, RexNode[] outerJoinConditions, JoinRelType[] joinTypes, BitSet[] projFields, Map<Integer,int[]> joinFieldRefCountsMap, RexNode postJoinFilter)
          Constructs a MultiJoinRel.
 
Method Summary
 MultiJoinRel clone()
          Clones this RelNode.
private  Map<Integer,int[]> cloneJoinFieldRefCountsMap()
          Returns a deep copy of joinFieldRefCountsMap.
 RelDataType deriveRowType()
           
 void explain(RelOptPlanWriter pw)
           
 RexNode[] getChildExps()
          Returns an array of this relational expression's child expressions (not including the inputs returned by RelNode.getInputs().
 Map<Integer,int[]> getCopyJoinFieldRefCountsMap()
           
 RelNode[] getInputs()
          Returns an array of this relational expression's inputs.
 Map<Integer,int[]> getJoinFieldRefCountsMap()
           
 RexNode getJoinFilter()
           
 JoinRelType[] getJoinTypes()
           
 RexNode[] getOuterJoinConditions()
           
 RexNode getPostJoinFilter()
           
 BitSet[] getProjFields()
           
 boolean isFullOuterJoin()
           
 void replaceInput(int ordinalInParent, RelNode p)
          Replaces the ordinalInParentth input.
 
Methods inherited from class org.eigenbase.rel.AbstractRelNode
childrenAccept, cloneTraits, collectVariablesSet, collectVariablesUsed, computeDigest, computeSelfCost, getCluster, getCollationList, getConvention, getCorrelVariable, getDescription, getDigest, getExpectedInputRowType, getId, getInput, getOrCreateCorrelVariable, getQuery, getRelTypeName, getRows, getRowType, getTable, getTraits, getVariablesStopped, 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

inputs

private RelNode[] inputs

joinFilter

private RexNode joinFilter

rowType

private RelDataType rowType

isFullOuterJoin

private boolean isFullOuterJoin

outerJoinConditions

private RexNode[] outerJoinConditions

joinTypes

private JoinRelType[] joinTypes

projFields

private BitSet[] projFields

joinFieldRefCountsMap

private Map<Integer,int[]> joinFieldRefCountsMap

postJoinFilter

private RexNode postJoinFilter
Constructor Detail

MultiJoinRel

public MultiJoinRel(RelOptCluster cluster,
                    RelNode[] inputs,
                    RexNode joinFilter,
                    RelDataType rowType,
                    boolean isFullOuterJoin,
                    RexNode[] outerJoinConditions,
                    JoinRelType[] joinTypes,
                    BitSet[] projFields,
                    Map<Integer,int[]> joinFieldRefCountsMap,
                    RexNode postJoinFilter)
Constructs a MultiJoinRel.

Parameters:
cluster - cluster that join belongs to
inputs - inputs into this multirel join
joinFilter - join filter applicable to this join node
rowType - row type of the join result of this node
isFullOuterJoin - true if the join is a full outer join
outerJoinConditions - outer join condition associated with each join input, if the input is null-generating in a left or right outer join; null otherwise
joinTypes - the join type corresponding to each input; if an input is null-generating in a left or right outer join, the entry indicates the type of outer join; otherwise, the entry is set to INNER
projFields - fields that will be projected from each input; if null, projection information is not available yet so it's assumed that all fields from the input are projected
joinFieldRefCountsMap - counters of the number of times each field is referenced in join conditions, indexed by the input #
postJoinFilter - filter to be applied after the joins are executed

MultiJoinRel

public MultiJoinRel(RelOptCluster cluster,
                    RelNode[] inputs,
                    RexNode joinFilter,
                    RelDataType rowType,
                    boolean isFullOuterJoin,
                    RexNode[] outerJoinConditions,
                    JoinRelType[] joinTypes,
                    BitSet[] projFields,
                    Map<Integer,int[]> joinFieldRefCountsMap)
Method Detail

clone

public MultiJoinRel 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

cloneJoinFieldRefCountsMap

private Map<Integer,int[]> cloneJoinFieldRefCountsMap()
Returns a deep copy of joinFieldRefCountsMap.


explain

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

deriveRowType

public RelDataType deriveRowType()
Overrides:
deriveRowType in class AbstractRelNode

getInputs

public RelNode[] getInputs()
Description copied from interface: RelNode
Returns an array of this relational expression's inputs. If there are no inputs, returns an empty array, not null.

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

getChildExps

public RexNode[] getChildExps()
Description copied from interface: RelNode
Returns an array of this relational expression's child expressions (not including the inputs returned by RelNode.getInputs(). If there are no child expressions, returns an empty array, not null.

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

replaceInput

public void replaceInput(int ordinalInParent,
                         RelNode p)
Description copied from interface: RelNode
Replaces the ordinalInParentth input. You must override this method if you override RelNode.getInputs().

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

getJoinFilter

public RexNode getJoinFilter()
Returns:
join filters associated with this MultiJoinRel

isFullOuterJoin

public boolean isFullOuterJoin()
Returns:
true if the MultiJoinRel corresponds to a full outer join.

getOuterJoinConditions

public RexNode[] getOuterJoinConditions()
Returns:
outer join conditions for null-generating inputs

getJoinTypes

public JoinRelType[] getJoinTypes()
Returns:
join types of each input

getProjFields

public BitSet[] getProjFields()
Returns:
bitmaps representing the fields projected from each input; if an entry is null, all fields are projected

getJoinFieldRefCountsMap

public Map<Integer,int[]> getJoinFieldRefCountsMap()
Returns:
the map of reference counts for each input, representing the fields accessed in join conditions

getCopyJoinFieldRefCountsMap

public Map<Integer,int[]> getCopyJoinFieldRefCountsMap()
Returns:
a copy of the map of reference counts for each input, representing the fields accessed in join conditions

getPostJoinFilter

public RexNode getPostJoinFilter()
Returns:
post-join filter associated with this MultiJoinRel