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| Constructor and Description |
|---|
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(SqlNode node,
boolean fail)
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,
SqlValidatorScope scope)
Returns a string describing the actual argument types of a call, e.g.
|
SqlLiteral |
getFunctionQuantifier() |
SqlMonotonicity |
getMonotonicity(SqlValidatorScope scope)
Returns whether expression is always ascending, descending or constant.
|
abstract List<SqlNode> |
getOperandList() |
abstract SqlOperator |
getOperator() |
boolean |
isCountStar()
Test to see if 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) |
int |
operandCount() |
void |
setOperand(int i,
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, cloneArray, equalDeep, equalDeep, getKind, getParserPosition, isA, toSqlString, toSqlString, toString, validateExprpublic SqlCall(SqlParserPos pos)
public boolean isExpanded()
public void setOperand(int i,
SqlNode operand)
SqlValidator; use sparingly.i - Operand indexoperand - Operand valuepublic abstract SqlOperator getOperator()
public <S extends SqlNode> S operand(int i)
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(SqlNode node, boolean fail)
SqlNodeequalsDeep in class SqlNodeprotected String getCallSignature(SqlValidator validator, SqlValidatorScope scope)
public SqlMonotonicity getMonotonicity(SqlValidatorScope scope)
SqlNodeThe default implementation returns
SqlMonotonicity.NOT_MONOTONIC.
getMonotonicity in class SqlNodepublic boolean isCountStar()
public SqlLiteral getFunctionQuantifier()
Copyright © 2012–2015 The Apache Software Foundation. All rights reserved.