Class SqlNodeList
- All Implemented Interfaces:
Cloneable
,Iterable<SqlNode>
,Collection<SqlNode>
,List<SqlNode>
,RandomAccess
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final SqlNodeList
An immutable, empty SqlNodeList.static final SqlNodeList
A SqlNodeList that has a single element that is an empty list.static final SqlNodeList
A 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
ConstructorDescriptionSqlNodeList
(Collection<? extends @Nullable SqlNode> collection, SqlParserPos pos) Creates aSqlNodeList
containing the nodes inlist
.SqlNodeList
(SqlParserPos pos) Creates a SqlNodeList that is initially empty. -
Method Summary
Modifier and TypeMethodDescription<R> R
accept
(SqlVisitor<R> visitor) Accepts a generic visitor.void
boolean
boolean
addAll
(int index, Collection<? extends @Nullable SqlNode> c) boolean
addAll
(Collection<? extends @Nullable SqlNode> c) void
clear()
clone
(SqlParserPos pos) Clones a SqlNode with a different position.boolean
boolean
containsAll
(Collection<?> c) boolean
boolean
equalsDeep
(@Nullable SqlNode node, Litmus litmus) Returns whether this node is structurally equivalent to another node.void
get
(int n) getList()
int
hashCode()
int
boolean
isEmpty()
static boolean
isEmptyList
(SqlNode node) iterator()
int
lastIndexOf
(@Nullable Object o) listIterator
(int index) static SqlNodeList
of
(SqlParserPos pos, List<@Nullable SqlNode> list) Creates a SqlNodeList with a given backing list.static SqlNodeList
static SqlNodeList
static SqlNodeList
remove
(int index) boolean
boolean
removeAll
(Collection<?> c) boolean
retainAll
(Collection<?> c) int
size()
subList
(int fromIndex, int toIndex) Object[]
toArray()
<T> @Nullable T[]
toArray
(T @Nullable [] a) void
Writes a SQL representation of this node to a writer.void
validate
(SqlValidator validator, SqlValidatorScope scope) Validates this node.void
validateExpr
(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, unparseWithParentheses
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods 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 aSqlNodeList
containing 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:
listIterator
in interfaceList<SqlNode>
-
listIterator
- Specified by:
listIterator
in interfaceList<SqlNode>
-
subList
-
get
-
set
-
contains
-
containsAll
- Specified by:
containsAll
in interfaceCollection<SqlNode>
- Specified by:
containsAll
in interfaceList<SqlNode>
-
indexOf
-
lastIndexOf
- Specified by:
lastIndexOf
in 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:SqlNode
Clones a SqlNode with a different position. -
unparse
Description copied from class:SqlNode
Writes a SQL representation of this node to a writer.The
leftPrec
andrightPrec
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
SqlCall.unparse(org.apache.calcite.sql.SqlWriter, int, int)
. -
validate
Description copied from class:SqlNode
Validates 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:SqlNode
Accepts a generic visitor.Implementations of this method in subtypes simply call the appropriate
visit
method on thevisitor object
.The type parameter
R
must be consistent with the type parameter of the visitor. -
equalsDeep
Description copied from class:SqlNode
Returns 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:
equalsDeep
in classSqlNode
-
isEmptyList
-
of
-
of
-
of
-
validateExpr
Description copied from class:SqlNode
Validates 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 aSqlIdentifier
can occur in expression and non-expression contexts.- Overrides:
validateExpr
in classSqlNode
-