Package org.apache.calcite.rex
Class RexInputRef
- java.lang.Object
-
- org.apache.calcite.rex.RexNode
-
- org.apache.calcite.rex.RexVariable
-
- org.apache.calcite.rex.RexSlot
-
- org.apache.calcite.rex.RexInputRef
-
- Direct Known Subclasses:
RexPatternFieldRef
,RexTableInputRef
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
- Input #0: EMP(EMPNO, ENAME, DEPTNO) and
- Input #1: DEPT(DEPTNO AS DEPTNO2, DNAME)
then the fields are:
- Field #0: EMPNO
- Field #1: ENAME
- Field #2: DEPTNO (from EMP)
- Field #3: DEPTNO2 (from DEPT)
- Field #4: DNAME
So
RexInputRef(3, Integer)
is the correct reference for the field DEPTNO2.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.calcite.rex.RexSlot
RexSlot.SelfPopulatingList
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.List<java.lang.String>
NAMES
-
Fields inherited from class org.apache.calcite.rex.RexVariable
name, type
-
-
Constructor Summary
Constructors Constructor Description RexInputRef(int index, RelDataType type)
Creates an input variable.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <R,P>
Raccept(RexBiVisitor<R,P> visitor, P arg)
Accepts a visitor with a payload, dispatching to the right overloadedRexBiVisitor.visitInputRef(RexInputRef, Object)
visitXxx} method.<R> R
accept(RexVisitor<R> visitor)
Accepts a visitor, dispatching to the right overloadedvisitXxx
method.static java.lang.String
createName(int index)
Creates a name for an input reference, of the form "$index".boolean
equals(java.lang.Object obj)
SqlKind
getKind()
Returns the kind of node this is.int
hashCode()
static RexInputRef
of(int index, java.util.List<RelDataTypeField> fields)
Creates a reference to a given field in a list of fields.static RexInputRef
of(int index, RelDataType rowType)
Creates a reference to a given field in a row type.static Pair<RexNode,java.lang.String>
of2(int index, java.util.List<RelDataTypeField> fields)
Creates a reference to a given field in a list of fields.-
Methods inherited from class org.apache.calcite.rex.RexVariable
getName, getType
-
Methods inherited from class org.apache.calcite.rex.RexNode
isA, isA, isAlwaysFalse, isAlwaysTrue, toString
-
-
-
-
Constructor Detail
-
RexInputRef
public RexInputRef(int index, RelDataType type)
Creates an input variable.- Parameters:
index
- Index of the field in the underlying row-typetype
- Type of the column
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object obj)
Description copied from class:RexNode
Every node must implement
RexNode.equals(java.lang.Object)
based on its content
-
hashCode
public int hashCode()
Description copied from class:RexNode
Every node must implement
RexNode.hashCode()
consistent withRexNode.equals(java.lang.Object)
-
of
public static RexInputRef of(int index, RelDataType rowType)
Creates a reference to a given field in a row type.
-
of
public static RexInputRef of(int index, java.util.List<RelDataTypeField> fields)
Creates a reference to a given field in a list of fields.
-
of2
public static Pair<RexNode,java.lang.String> of2(int index, java.util.List<RelDataTypeField> fields)
Creates a reference to a given field in a list of fields.
-
getKind
public SqlKind getKind()
Description copied from class:RexNode
Returns the kind of node this is.
-
accept
public <R> R accept(RexVisitor<R> visitor)
Description copied from class:RexNode
Accepts a visitor, dispatching to the right overloadedvisitXxx
method.Also see
RexUtil.apply(RexVisitor, java.util.List, RexNode)
, which applies a visitor to several expressions simultaneously.
-
accept
public <R,P> R accept(RexBiVisitor<R,P> visitor, P arg)
Description copied from class:RexNode
Accepts a visitor with a payload, dispatching to the right overloadedRexBiVisitor.visitInputRef(RexInputRef, Object)
visitXxx} method.
-
createName
public static java.lang.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.
-
-