Class SqlNodeList
- All Implemented Interfaces:
Cloneable,Iterable<SqlNode>,Collection<SqlNode>,List<SqlNode>,RandomAccess
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SqlNodeListAn immutable, empty SqlNodeList.static final SqlNodeListA SqlNodeList that has a single element that is an empty list.static final SqlNodeListA SqlNodeList that has a single element that is a star identifier.Fields inherited from class org.apache.calcite.sql.SqlNode
EMPTY_ARRAY, pos -
Constructor Summary
ConstructorsConstructorDescriptionSqlNodeList(Collection<? extends @Nullable SqlNode> collection, SqlParserPos pos) Creates aSqlNodeListcontaining the nodes inlist.SqlNodeList(SqlParserPos pos) Creates a SqlNodeList that is initially empty. -
Method Summary
Modifier and TypeMethodDescription<R> Raccept(SqlVisitor<R> visitor) Accepts a generic visitor.voidbooleanbooleanaddAll(int index, Collection<? extends @Nullable SqlNode> c) booleanaddAll(Collection<? extends @Nullable SqlNode> c) voidclear()clone(SqlParserPos pos) Clones a SqlNode with a different position.booleanbooleancontainsAll(Collection<?> c) booleanbooleanequalsDeep(@Nullable SqlNode node, Litmus litmus) Returns whether this node is structurally equivalent to another node.voidget(int n) getList()inthashCode()intbooleanisEmpty()static booleanisEmptyList(SqlNode node) iterator()intlastIndexOf(@Nullable Object o) listIterator(int index) static SqlNodeListof(SqlParserPos pos, List<@Nullable SqlNode> list) Creates a SqlNodeList with a given backing list.static SqlNodeListstatic SqlNodeListstatic SqlNodeListremove(int index) booleanbooleanremoveAll(Collection<?> c) booleanretainAll(Collection<?> c) intsize()subList(int fromIndex, int toIndex) Object[]toArray()<T> @Nullable T[]toArray(T @Nullable [] a) voidWrites a SQL representation of this node to a writer.voidvalidate(SqlValidator validator, SqlValidatorScope scope) Validates this node.voidvalidateExpr(SqlValidator validator, SqlValidatorScope scope) Validates this node in an expression context.Methods inherited from class org.apache.calcite.sql.SqlNode
clone, clone, cloneArray, equalDeep, equalDeep, equalsDeep, findValidOptions, getKind, getMonotonicity, getParserPosition, isA, toList, toList, toSqlString, toSqlString, toSqlString, toString, unparseWithParenthesesMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
replaceAll, sort, spliterator
-
Field Details
-
EMPTY
An immutable, empty SqlNodeList. -
SINGLETON_EMPTY
A SqlNodeList that has a single element that is an empty list. -
SINGLETON_STAR
A SqlNodeList that has a single element that is a star identifier.
-
-
Constructor Details
-
SqlNodeList
Creates a SqlNodeList that is initially empty. -
SqlNodeList
Creates aSqlNodeListcontaining the nodes inlist. The list is copied, but the nodes in it are not.
-
-
Method Details
-
of
Creates a SqlNodeList with a given backing list. Does not copy the list. -
hashCode
public int hashCode() -
equals
-
isEmpty
public boolean isEmpty() -
size
public int size() -
forEach
-
iterator
-
listIterator
- Specified by:
listIteratorin interfaceList<SqlNode>
-
listIterator
- Specified by:
listIteratorin interfaceList<SqlNode>
-
subList
-
get
-
set
-
contains
-
containsAll
- Specified by:
containsAllin interfaceCollection<SqlNode>- Specified by:
containsAllin interfaceList<SqlNode>
-
indexOf
-
lastIndexOf
- Specified by:
lastIndexOfin interfaceList<SqlNode>
-
toArray
-
toArray
public <T> @Nullable T[] toArray(T @Nullable [] a) -
add
-
add
-
addAll
-
addAll
-
clear
public void clear() -
remove
-
remove
-
removeAll
-
retainAll
-
getList
-
clone
Description copied from class:SqlNodeClones a SqlNode with a different position. -
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. -
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
-
isEmptyList
-
of
-
of
-
of
-
validateExpr
Description copied from class:SqlNodeValidates this node in an expression context.Usually, this method does much the same as
SqlNode.validate(org.apache.calcite.sql.validate.SqlValidator, org.apache.calcite.sql.validate.SqlValidatorScope), but aSqlIdentifiercan occur in expression and non-expression contexts.- Overrides:
validateExprin classSqlNode
-