org.eigenbase.rex
Class RexCall

java.lang.Object
  extended by org.eigenbase.rex.RexNode
      extended by org.eigenbase.rex.RexCall
Direct Known Subclasses:
FennelWindowRel.RexWinAggCall, RexOver

public class RexCall
extends RexNode

An expression formed by a call to an operator with zero or more expressions as operands.

Operators may be binary, unary, functions, special syntactic constructs like CASE ... WHEN ... END, or even internally generated constructs like implicit type conversions. The syntax of the operator is really irrelevant, because row-expressions (unlike SQL expressions) do not directly represent a piece of source code.

It's not often necessary to sub-class this class. The smarts should be in the operator, rather than the call. Any extra information about the call can often be encoded as extra arguments. (These don't need to be hidden, because no one is going to be generating source code from this tree.)

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

Field Summary
private  RexKind kind
           
private  SqlOperator op
           
 RexNode[] operands
           
private  RelDataType type
           
 
Fields inherited from class org.eigenbase.rex.RexNode
digest, EMPTY_ARRAY
 
Constructor Summary
protected RexCall(RelDataType type, SqlOperator op, RexNode[] operands)
           
 
Method Summary
<R> R
accept(RexVisitor<R> visitor)
          Accepts a visitor, dispatching to the right overloaded visitXxx method.
 RexCall clone()
           
 RexCall clone(RelDataType type, RexNode[] operands)
          Creates a new call to the same operator with different operands.
protected  String computeDigest(boolean withType)
           
 RexKind getKind()
          Returns the kind of node this is.
 RexNode[] getOperands()
           
 SqlOperator getOperator()
           
 RelDataType getType()
           
(package private) static RexKind sqlKindToRexKind(SqlKind kind)
          Returns the RexKind corresponding to a SqlKind.
 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

op

private final SqlOperator op

operands

public final RexNode[] operands

type

private final RelDataType type

kind

private final RexKind kind
Constructor Detail

RexCall

protected RexCall(RelDataType type,
                  SqlOperator op,
                  RexNode[] operands)
Method Detail

sqlKindToRexKind

static RexKind sqlKindToRexKind(SqlKind kind)
Returns the RexKind corresponding to a SqlKind. Fails if there is none.

"Postcondition:"
return != null

computeDigest

protected String computeDigest(boolean withType)

toString

public String toString()
Overrides:
toString 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

getType

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

clone

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

getOperands

public RexNode[] getOperands()

getOperator

public SqlOperator getOperator()

clone

public RexCall clone(RelDataType type,
                     RexNode[] operands)
Creates a new call to the same operator with different operands.

Parameters:
type - Return type
operands - Operands to call
Returns:
New call