org.eigenbase.rex
Class RexRangeRef

java.lang.Object
  extended by org.eigenbase.rex.RexNode
      extended by org.eigenbase.rex.RexRangeRef

public class RexRangeRef
extends RexNode

Reference to a range of columns.

This construct is used only during the process of translating a SQL tree to a rel/rex tree. Regular rex trees do not contain this construct.

While translating a join of EMP(EMPNO, ENAME, DEPTNO) to DEPT(DEPTNO2, DNAME) we create RexRangeRef(DeptType,3) to represent the pair of columns (DEPTNO2, DNAME) which came from DEPT. The type has 2 columns, and therefore the range represents columns {3, 4} of the input.

Suppose we later create a reference to the DNAME field of this RexRangeRef; it will return a RexInputRef(5,Integer), and the RexRangeRef will disappear.

Since:
Nov 23, 2003
Version:
$Id: //open/dev/farrago/src/org/eigenbase/rex/RexRangeRef.java#15 $
Author:
jhyde

Field Summary
private  int offset
           
private  RelDataType type
           
 
Fields inherited from class org.eigenbase.rex.RexNode
digest, EMPTY_ARRAY
 
Constructor Summary
RexRangeRef(RelDataType rangeType, int offset)
          Creates a range reference.
 
Method Summary
<R> R
accept(RexVisitor<R> visitor)
          Accepts a visitor, dispatching to the right overloaded visitXxx method.
 RexRangeRef clone()
           
 int getOffset()
           
 RelDataType 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

type

private final RelDataType type

offset

private final int offset
Constructor Detail

RexRangeRef

RexRangeRef(RelDataType rangeType,
            int offset)
Creates a range reference.

Parameters:
rangeType - Type of the record returned
offset - Offset of the first column within the input record
Method Detail

getType

public RelDataType getType()
Specified by:
getType in class RexNode

getOffset

public int getOffset()

clone

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