Class SqlDynamicParam
- All Implemented Interfaces:
Cloneable
SqlDynamicParam represents a dynamic parameter marker in an
SQL statement. The textual order in which dynamic parameters appear within an
SQL statement is the only property which distinguishes them, so this 0-based
index is recorded as soon as the parameter is encountered.-
Field Summary
Fields inherited from class org.apache.calcite.sql.SqlNode
EMPTY_ARRAY, pos -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<R> Raccept(SqlVisitor<R> visitor) Accepts a generic visitor.clone(SqlParserPos pos) Clones a SqlNode with a different position.booleanequalsDeep(@Nullable SqlNode node, Litmus litmus) Returns whether this node is structurally equivalent to another node.intgetIndex()getKind()Returns the type of node this is, orSqlKind.OTHERif it's nothing special.getMonotonicity(SqlValidatorScope scope) Returns whether expression is always ascending, descending or constant.voidWrites a SQL representation of this node to a writer.voidvalidate(SqlValidator validator, SqlValidatorScope scope) Validates this node.Methods inherited from class org.apache.calcite.sql.SqlNode
clone, clone, cloneArray, equalDeep, equalDeep, equalsDeep, findValidOptions, getParserPosition, isA, toList, toList, toSqlString, toSqlString, toSqlString, toString, unparseWithParentheses, validateExpr
-
Constructor Details
-
SqlDynamicParam
-
-
Method Details
-
clone
Description copied from class:SqlNodeClones a SqlNode with a different position. -
getKind
Description copied from class:SqlNodeReturns the type of node this is, orSqlKind.OTHERif it's nothing special. -
getIndex
public int getIndex() -
unparse
Description copied from class:SqlNodeWrites a SQL representation of this node to a writer.The
leftPrecandrightPrecparameters 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
SqlCall.unparse(org.apache.calcite.sql.SqlWriter, int, int). -
validate
Description copied from class:SqlNodeValidates this node.The typical implementation of this method will make a callback to the validator appropriate to the node type and context. The validator has methods such as
SqlValidator.validateLiteral(org.apache.calcite.sql.SqlLiteral)for these purposes. -
getMonotonicity
Description copied from class:SqlNodeReturns whether expression is always ascending, descending or constant. This property is useful because it allows to safely aggregate infinite streams of values.The default implementation returns
SqlMonotonicity.NOT_MONOTONIC.- Overrides:
getMonotonicityin classSqlNode- Parameters:
scope- Scope
-
accept
Description copied from class:SqlNodeAccepts a generic visitor.Implementations of this method in subtypes simply call the appropriate
visitmethod on thevisitor object.The type parameter
Rmust be consistent with the type parameter of the visitor. -
equalsDeep
Description copied from class:SqlNodeReturns whether this node is structurally equivalent to another node. Some examples:- 1 + 2 is structurally equivalent to 1 + 2
- 1 + 2 + 3 is structurally equivalent to (1 + 2) + 3, but not to 1 + (2 + 3), because the '+' operator is left-associative
- Specified by:
equalsDeepin classSqlNode
-