org.eigenbase.rex
Class RexInputRef

java.lang.Object
  extended by org.eigenbase.rex.RexNode
      extended by org.eigenbase.rex.RexVariable
          extended by org.eigenbase.rex.RexSlot
              extended by org.eigenbase.rex.RexInputRef

public class RexInputRef
extends RexSlot

Variable which references a field of an input relational expression.

Fields of the input are 0-based. If there is more than one input, they are numbered consecutively. For example, if the inputs to a join are

then the fields are: So RexInputRef(3,Integer) is the correct reference for the field DEPTNO2.

Since:
Nov 24, 2003
Version:
$Id: //open/dev/farrago/src/org/eigenbase/rex/RexInputRef.java#16 $
Author:
jhyde

Field Summary
private static String[] names
           
 
Fields inherited from class org.eigenbase.rex.RexSlot
index
 
Fields inherited from class org.eigenbase.rex.RexVariable
name, type
 
Fields inherited from class org.eigenbase.rex.RexNode
digest, EMPTY_ARRAY
 
Constructor Summary
RexInputRef(int index, RelDataType type)
          Creates an input variable.
 
Method Summary
<R> R
accept(RexVisitor<R> visitor)
          Accepts a visitor, dispatching to the right overloaded visitXxx method.
 RexInputRef clone()
           
static String createName(int index)
          Creates a name for an input reference, of the form "$index".
 
Methods inherited from class org.eigenbase.rex.RexSlot
getIndex, makeArray
 
Methods inherited from class org.eigenbase.rex.RexVariable
getName, getType
 
Methods inherited from class org.eigenbase.rex.RexNode
getKind, isA, isAlwaysTrue, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

names

private static final String[] names
Constructor Detail

RexInputRef

public RexInputRef(int index,
                   RelDataType type)
Creates an input variable.

Parameters:
index - Index of the field in the underlying rowtype
type - Type of the column
"Precondition:"
type != null, index >= 0
Method Detail

clone

public RexInputRef clone()
Specified by:
clone in class RexNode

accept

public <R> R accept(RexVisitor<R> visitor)
Description copied from class: RexNode
Accepts a visitor, dispatching to the right overloaded visitXxx method.

Also see RexProgram.apply(RexVisitor, RexNode[], RexNode), which applies a visitor to several expressions simultaneously.

Specified by:
accept in class RexNode

createName

public static String createName(int index)
Creates a name for an input reference, of the form "$index". If the index is low, uses a cache of common names, to reduce gc.