public abstract class SqlCall extends SqlNode
SqlCall is a call to an operator.
(Operators can be used to describe any syntactic construct, so in practice,
every non-leaf node in a SQL parse tree is a SqlCall of some
kind.)EMPTY_ARRAY, pos| Modifier | Constructor and Description |
|---|---|
protected |
SqlCall(SqlParserPos pos) |
| Modifier and Type | Method and Description |
|---|---|
<R> R |
accept(SqlVisitor<R> visitor)
Accepts a generic visitor.
|
SqlNode |
clone(SqlParserPos pos)
Clones a SqlNode with a different position.
|
boolean |
equalsDeep(@Nullable SqlNode node,
Litmus litmus)
Returns whether this node is structurally equivalent to another node.
|
void |
findValidOptions(SqlValidator validator,
SqlValidatorScope scope,
SqlParserPos pos,
Collection<SqlMoniker> hintList)
Lists all the valid alternatives for this node if the parse position of
the node matches that of pos.
|
protected String |
getCallSignature(SqlValidator validator,
@Nullable SqlValidatorScope scope)
Returns a string describing the actual argument types of a call, e.g.
|
@Nullable SqlLiteral |
getFunctionQuantifier() |
SqlKind |
getKind()
Returns the type of node this is, or
SqlKind.OTHER if it's nothing special. |
SqlMonotonicity |
getMonotonicity(@Nullable SqlValidatorScope scope)
Returns whether expression is always ascending, descending or constant.
|
abstract List<SqlNode> |
getOperandList()
Returns the list of operands.
|
abstract SqlOperator |
getOperator() |
boolean |
isCountStar()
Returns whether it is the function
COUNT(*). |
boolean |
isExpanded()
Whether this call was created by expanding a parentheses-free call to
what was syntactically an identifier.
|
<S extends SqlNode> |
operand(int i)
Returns i-th operand (0-based).
|
int |
operandCount() |
void |
setOperand(int i,
@Nullable SqlNode operand)
Changes the value of an operand.
|
void |
unparse(SqlWriter writer,
int leftPrec,
int rightPrec)
Writes a SQL representation of this node to a writer.
|
void |
validate(SqlValidator validator,
SqlValidatorScope scope)
Validates this call.
|
clone, clone, cloneArray, equalDeep, equalDeep, equalsDeep, getParserPosition, isA, toList, toList, toSqlString, toSqlString, toSqlString, toString, unparseWithParentheses, validateExprprotected SqlCall(SqlParserPos pos)
public boolean isExpanded()
public void setOperand(int i,
@Nullable SqlNode operand)
SqlValidator; use sparingly.i - Operand indexoperand - Operand valuepublic SqlKind getKind()
SqlNodeSqlKind.OTHER if it's nothing special.getKind in class SqlNodeSqlKind value, never nullSqlNode.isA(java.util.Set<org.apache.calcite.sql.SqlKind>)@Pure public abstract SqlOperator getOperator()
public abstract List<SqlNode> getOperandList()
Note: the proper type would be List<@Nullable SqlNode>, however,
it would trigger too many changes to the current codebase.
public <S extends SqlNode> S operand(int i)
Note: the result might be null, so the proper signature would be
<S extends @Nullable SqlNode>, however, it would trigger to many changes to the current
codebase.
S - type of the resulti - operand index (0-based)public int operandCount()
public SqlNode clone(SqlParserPos pos)
SqlNodepublic void unparse(SqlWriter writer, int leftPrec, int rightPrec)
SqlNodeThe leftPrec and rightPrec parameters give
us enough context to decide whether we need to enclose the expression in
parentheses. For example, we need parentheses around "2 + 3" if preceded
by "5 *". This is because the precedence of the "*" operator is greater
than the precedence of the "+" operator.
The algorithm handles left- and right-associative operators by giving them slightly different left- and right-precedence.
If SqlWriter.isAlwaysUseParentheses() is true, we use
parentheses even when they are not required by the precedence rules.
For the details of this algorithm, see unparse(org.apache.calcite.sql.SqlWriter, int, int).
public void validate(SqlValidator validator, SqlValidatorScope scope)
The default implementation delegates the validation to the operator's
SqlOperator.validateCall(org.apache.calcite.sql.SqlCall, org.apache.calcite.sql.validate.SqlValidator, org.apache.calcite.sql.validate.SqlValidatorScope, org.apache.calcite.sql.validate.SqlValidatorScope). Derived classes may override (as do,
for example SqlSelect and SqlUpdate).
public void findValidOptions(SqlValidator validator, SqlValidatorScope scope, SqlParserPos pos, Collection<SqlMoniker> hintList)
SqlNodefindValidOptions in class SqlNodevalidator - Validatorscope - Validation scopepos - SqlParserPos indicating the cursor position at which
completion hints are requested forhintList - list of valid optionspublic <R> R accept(SqlVisitor<R> visitor)
SqlNodeImplementations of this method in subtypes simply call the appropriate
visit method on the
visitor object.
The type parameter R must be consistent with the type
parameter of the visitor.
public boolean equalsDeep(@Nullable SqlNode node, Litmus litmus)
SqlNodeequalsDeep in class SqlNodeprotected String getCallSignature(SqlValidator validator, @Nullable SqlValidatorScope scope)
public SqlMonotonicity getMonotonicity(@Nullable SqlValidatorScope scope)
SqlNodeThe default implementation returns
SqlMonotonicity.NOT_MONOTONIC.
getMonotonicity in class SqlNodescope - Scopepublic boolean isCountStar()
COUNT(*).@Pure public @Nullable SqlLiteral getFunctionQuantifier()
Copyright © 2012-2022 Apache Software Foundation. All Rights Reserved.