org.eigenbase.rel
Class ProjectRel

java.lang.Object
  extended by org.eigenbase.rel.AbstractRelNode
      extended by org.eigenbase.rel.SingleRel
          extended by org.eigenbase.rel.ProjectRelBase
              extended by org.eigenbase.rel.ProjectRel
All Implemented Interfaces:
Cloneable, RelNode

public final class ProjectRel
extends ProjectRelBase

ProjectRel is a relational expression which computes a set of 'select expressions' from its input relational expression.

The result is usually 'boxed' as a record with one named field for each column; if there is precisely one expression, the result may be 'unboxed', and consist of the raw value type.

Since:
March, 2004
Version:
$Id: //open/dev/farrago/src/org/eigenbase/rel/ProjectRel.java#18 $
Author:
jhyde

Nested Class Summary
 
Nested classes/interfaces inherited from class org.eigenbase.rel.ProjectRelBase
ProjectRelBase.Flags
 
Field Summary
 
Fields inherited from class org.eigenbase.rel.ProjectRelBase
exps, flags
 
Fields inherited from class org.eigenbase.rel.AbstractRelNode
digest, id, nextId, rowType, traits
 
Fields inherited from interface org.eigenbase.rel.RelNode
emptyArray
 
Constructor Summary
ProjectRel(RelOptCluster cluster, RelNode child, RexNode[] exps, RelDataType rowType, int flags, List<RelCollation> collationList)
          Creates a ProjectRel.
ProjectRel(RelOptCluster cluster, RelNode child, RexNode[] exps, String[] fieldNames, int flags)
          Creates a ProjectRel with no sort keys.
 
Method Summary
 ProjectRel clone()
          Clones this RelNode.
 Permutation getPermutation()
          Returns a permutation, if this projection is merely a permutation of its input fields, otherwise null.
 
Methods inherited from class org.eigenbase.rel.ProjectRelBase
computeSelfCost, explain, getChildExps, getCollationList, getFlags, getProjectExps, implementFieldAccess, isBoxed, isValid
 
Methods inherited from class org.eigenbase.rel.SingleRel
childrenAccept, deriveRowType, getChild, getInputs, getRows, replaceInput
 
Methods inherited from class org.eigenbase.rel.AbstractRelNode
cloneTraits, collectVariablesSet, collectVariablesUsed, computeDigest, getCluster, getConvention, getCorrelVariable, getDescription, getDigest, getExpectedInputRowType, getId, getInput, getOrCreateCorrelVariable, getQuery, getRelTypeName, getRowType, getTable, getTraits, getVariablesStopped, inheritTraitsFrom, isAccessTo, isDistinct, onRegister, recomputeDigest, register, registerCorrelVariable, setCorrelVariable, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProjectRel

public ProjectRel(RelOptCluster cluster,
                  RelNode child,
                  RexNode[] exps,
                  String[] fieldNames,
                  int flags)
Creates a ProjectRel with no sort keys.

Parameters:
cluster - Cluster this relational expression belongs to
child - input relational expression
exps - set of expressions for the input columns
fieldNames - aliases of the expressions
flags - values as in ProjectRelBase.Flags

ProjectRel

public ProjectRel(RelOptCluster cluster,
                  RelNode child,
                  RexNode[] exps,
                  RelDataType rowType,
                  int flags,
                  List<RelCollation> collationList)
Creates a ProjectRel.

Parameters:
cluster - Cluster this relational expression belongs to
child - input relational expression
exps - set of expressions for the input columns
rowType - output row type
flags - values as in ProjectRelBase.Flags
collationList - List of sort keys
Method Detail

clone

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

getPermutation

public Permutation getPermutation()
Returns a permutation, if this projection is merely a permutation of its input fields, otherwise null.