Class RexCall
- Direct Known Subclasses:
Match.RexMRAggCall
,RexOver
,RexSubQuery
,Window.RexWinAggCall
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.)
-
Field Summary
Modifier and TypeFieldDescriptionprotected int
Cache of hash code.final int
final SqlOperator
final com.google.common.collect.ImmutableList<RexNode>
final RelDataType
-
Constructor Summary
ModifierConstructorDescriptionprotected
RexCall
(RelDataType type, SqlOperator operator, List<? extends RexNode> operands) -
Method Summary
Modifier and TypeMethodDescription<R,
P> R accept
(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.protected final void
Appends call operands without parenthesis.clone
(RelDataType type, List<RexNode> operands) Creates a new call to the same operator with different operands.protected String
computeDigest
(boolean withType) boolean
getKind()
Returns the kind of node this is.getType()
int
hashCode()
boolean
Returns whether this expression always returns false.boolean
Returns whether this expression always returns true.int
Returns the number of nodes in this expression.int
final String
toString()
-
Field Details
-
op
-
operands
-
type
-
nodeCount
public final int nodeCount -
hash
protected int hashCache of hash code.
-
-
Constructor Details
-
RexCall
-
-
Method Details
-
appendOperands
Appends call operands without parenthesis.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 maintainRelNode.getDigest()
contract.- Parameters:
sb
- destination- See Also:
-
computeDigest
-
toString
-
accept
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
Description copied from class:RexNode
Accepts a visitor with a payload, dispatching to the right overloadedRexBiVisitor.visitInputRef(RexInputRef, Object)
visitXxx} method. -
getType
-
isAlwaysTrue
public boolean isAlwaysTrue()Description copied from class:RexNode
Returns whether this expression always returns true. (Such as if this expression is equal to the literalTRUE
.)- Overrides:
isAlwaysTrue
in classRexNode
-
isAlwaysFalse
public boolean isAlwaysFalse()Description copied from class:RexNode
Returns whether this expression always returns false. (Such as if this expression is equal to the literalFALSE
.)- Overrides:
isAlwaysFalse
in classRexNode
-
getKind
Description copied from class:RexNode
Returns the kind of node this is. -
getOperands
-
operandCount
public int operandCount() -
getOperator
-
nodeCount
public int nodeCount()Description copied from class:RexNode
Returns the number of nodes in this expression.Leaf nodes, such as
RexInputRef
orRexLiteral
, 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.
-
clone
Creates a new call to the same operator with different operands.- Parameters:
type
- Return typeoperands
- Operands to call- Returns:
- New call
-
equals
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)
-