public class RexCall extends RexNode
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.)
| Modifier and Type | Field and Description |
|---|---|
protected int |
hash
Cache of hash code.
|
int |
nodeCount |
SqlOperator |
op |
com.google.common.collect.ImmutableList<RexNode> |
operands |
RelDataType |
type |
| Modifier | Constructor and Description |
|---|---|
protected |
RexCall(RelDataType type,
SqlOperator op,
List<? extends RexNode> operands) |
| Modifier and Type | Method and Description |
|---|---|
<R,P> R |
accept(RexBiVisitor<R,P> visitor,
P arg)
Accepts a visitor with a payload, dispatching to the right overloaded
RexBiVisitor.visitInputRef(RexInputRef, Object) visitXxx} method. |
<R> R |
accept(RexVisitor<R> visitor)
Accepts a visitor, dispatching to the right overloaded
visitXxx method. |
protected void |
appendOperands(StringBuilder sb)
Appends call operands without parenthesis.
|
RexCall |
clone(RelDataType type,
List<RexNode> operands)
Creates a new call to the same operator with different operands.
|
protected String |
computeDigest(boolean withType) |
boolean |
equals(Object o)
Every node must implement
RexNode.equals(java.lang.Object) based on its content |
SqlKind |
getKind()
Returns the kind of node this is.
|
List<RexNode> |
getOperands() |
SqlOperator |
getOperator() |
RelDataType |
getType() |
int |
hashCode()
Every node must implement
RexNode.hashCode() consistent with
RexNode.equals(java.lang.Object) |
boolean |
isAlwaysFalse()
Returns whether this expression always returns false.
|
boolean |
isAlwaysTrue()
Returns whether this expression always returns true.
|
int |
nodeCount()
Returns the number of nodes in this expression.
|
String |
toString() |
public final SqlOperator op
public final com.google.common.collect.ImmutableList<RexNode> operands
public final RelDataType type
public final int nodeCount
protected int hash
protected RexCall(RelDataType type, SqlOperator op, List<? extends RexNode> operands)
protected final void appendOperands(StringBuilder sb)
RexLiteral might omit data type depending on the context.
For instance, null:BOOLEAN vs =(true, null).
The idea here is to omit "obvious" types for readability purposes while
still maintain RelNode.getDigest() contract.sb - destinationRexLiteral.computeDigest(RexDigestIncludeType)public <R> R accept(RexVisitor<R> visitor)
RexNodevisitXxx method.
Also see RexUtil.apply(RexVisitor, java.util.List, RexNode),
which applies a visitor to several expressions simultaneously.
public <R,P> R accept(RexBiVisitor<R,P> visitor, P arg)
RexNodeRexBiVisitor.visitInputRef(RexInputRef, Object) visitXxx} method.public RelDataType getType()
public boolean isAlwaysTrue()
RexNodeTRUE.)isAlwaysTrue in class RexNodepublic boolean isAlwaysFalse()
RexNodeFALSE.)isAlwaysFalse in class RexNodepublic SqlKind getKind()
RexNodepublic SqlOperator getOperator()
public int nodeCount()
RexNodeLeaf nodes, such as RexInputRef or RexLiteral, have
a count of 1. Calls have a count of 1 plus the sum of their operands.
Node count is a measure of expression complexity that is used by some planner rules to prevent deeply nested expressions.
public RexCall clone(RelDataType type, List<RexNode> operands)
type - Return typeoperands - Operands to callpublic boolean equals(Object o)
RexNodeEvery node must implement RexNode.equals(java.lang.Object) based on its content
public int hashCode()
RexNodeEvery node must implement RexNode.hashCode() consistent with
RexNode.equals(java.lang.Object)
Copyright © 2012-2020 Apache Software Foundation. All Rights Reserved.