org.eigenbase.rex
Class RexFieldAccess

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

public class RexFieldAccess
extends RexNode

Access to a field of a row-expression.

You might expect to use a RexFieldAccess to access columns of relational tables, for example, the expression emp.empno in the query

SELECT emp.empno FROM emp
but there is a specialized expression RexInputRef for this purpose. So in practice, RexFieldAccess is usually used to access fields of correlating variabless, for example the expression emp.deptno in
SELECT ename
 FROM dept
 WHERE EXISTS (
     SELECT NULL
     FROM emp
     WHERE emp.deptno = dept.deptno
     AND gender = 'F')

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

Field Summary
private  RexNode expr
           
private  RelDataTypeField field
           
 
Fields inherited from class org.eigenbase.rex.RexNode
digest, EMPTY_ARRAY
 
Constructor Summary
RexFieldAccess(RexNode expr, RelDataTypeField field)
           
 
Method Summary
<R> R
accept(RexVisitor<R> visitor)
          Accepts a visitor, dispatching to the right overloaded visitXxx method.
 RexFieldAccess clone()
           
private  String computeDigest()
           
 RelDataTypeField getField()
           
 RexKind getKind()
          Returns the kind of node this is.
 String getName()
          Returns the name of the field.
 RexNode getReferenceExpr()
          Returns the expression whose field is being accessed.
 RelDataType getType()
           
 void setReferenceExpr(RexNode expr)
           
 String toString()
           
 
Methods inherited from class org.eigenbase.rex.RexNode
isA, isAlwaysTrue
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

expr

private RexNode expr

field

private final RelDataTypeField field
Constructor Detail

RexFieldAccess

RexFieldAccess(RexNode expr,
               RelDataTypeField field)
Method Detail

getField

public RelDataTypeField getField()

getType

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

clone

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

getKind

public RexKind getKind()
Description copied from class: RexNode
Returns the kind of node this is.

Overrides:
getKind in class RexNode
Returns:
A RexKind value, never null

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

getReferenceExpr

public RexNode getReferenceExpr()
Returns the expression whose field is being accessed.


setReferenceExpr

public void setReferenceExpr(RexNode expr)

getName

public String getName()
Returns the name of the field.


toString

public String toString()
Overrides:
toString in class RexNode

computeDigest

private String computeDigest()