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 |
---|---|
SqlOperator |
op |
com.google.common.collect.ImmutableList<RexNode> |
operands |
private static java.util.Set<SqlKind> |
SIMPLE_BINARY_OPS
Simple binary operators are those operators which expects operands from the same Domain.
|
RelDataType |
type |
Modifier | Constructor and Description |
---|---|
protected |
RexCall(RelDataType type,
SqlOperator op,
java.util.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 java.lang.StringBuilder |
appendOperands(java.lang.StringBuilder sb)
Appends call operands without parenthesis.
|
RexCall |
clone(RelDataType type,
java.util.List<RexNode> operands)
Creates a new call to the same operator with different operands.
|
protected java.lang.String |
computeDigest(boolean withType) |
boolean |
equals(java.lang.Object obj) |
private static boolean |
equalSansNullability(RelDataType a,
RelDataType b)
This is a poorman's
SqlTypeUtil.equalSansNullability(RelDataTypeFactory, RelDataType, RelDataType) |
SqlKind |
getKind()
Returns the kind of node this is.
|
java.util.List<RexNode> |
getOperands() |
SqlOperator |
getOperator() |
RelDataType |
getType() |
int |
hashCode() |
boolean |
isAlwaysFalse()
Returns whether this expression always returns false.
|
boolean |
isAlwaysTrue()
Returns whether this expression always returns true.
|
java.lang.String |
toString() |
public final SqlOperator op
public final com.google.common.collect.ImmutableList<RexNode> operands
public final RelDataType type
private static final java.util.Set<SqlKind> SIMPLE_BINARY_OPS
Example: simple comparisions (=
, <
).
Note: it does not contain IN
because that is defined on D x D^n.
protected RexCall(RelDataType type, SqlOperator op, java.util.List<? extends RexNode> operands)
protected final java.lang.StringBuilder appendOperands(java.lang.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 RelOptNode.getDigest()
contract.sb
- destinationRexLiteral.computeDigest(RexDigestIncludeType)
private static boolean equalSansNullability(RelDataType a, RelDataType b)
SqlTypeUtil.equalSansNullability(RelDataTypeFactory, RelDataType, RelDataType)
SqlTypeUtil
requires RelDataTypeFactory
which we haven't, so we assume that
"not null" is represented in the type's digest as a trailing "NOT NULL" (case sensitive)
a
- first typeb
- second type@Nonnull protected java.lang.String computeDigest(boolean withType)
public <R> R accept(RexVisitor<R> visitor)
RexNode
visitXxx
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)
RexNode
RexBiVisitor.visitInputRef(RexInputRef, Object)
visitXxx} method.public RelDataType getType()
public boolean isAlwaysTrue()
RexNode
TRUE
.)isAlwaysTrue
in class RexNode
public boolean isAlwaysFalse()
RexNode
FALSE
.)isAlwaysFalse
in class RexNode
public SqlKind getKind()
RexNode
public java.util.List<RexNode> getOperands()
public SqlOperator getOperator()
public RexCall clone(RelDataType type, java.util.List<RexNode> operands)
type
- Return typeoperands
- Operands to callpublic boolean equals(java.lang.Object obj)
RexNode
Every node must implement RexNode.equals(java.lang.Object)
based on its content
public int hashCode()
RexNode
Every node must implement RexNode.hashCode()
consistent with
RexNode.equals(java.lang.Object)
Copyright © 2012–2019 The Apache Software Foundation. All rights reserved.