Package org.apache.calcite.sql.validate
Class WithScope
- java.lang.Object
-
- org.apache.calcite.sql.validate.DelegatingScope
-
- org.apache.calcite.sql.validate.ListScope
-
- org.apache.calcite.sql.validate.WithScope
-
- All Implemented Interfaces:
SqlValidatorScope
class WithScope extends ListScope
Scope providing the objects that are available after evaluating an item in a WITH clause.For example, in
WITH t1 AS (q1) t2 AS (q2) q3
t1
provides a scope that is used to validateq2
(and thereforeq2
may referencet1
), andt2
provides a scope that is used to validateq3
(and therefore q3 may referencet1
andt2
).
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.calcite.sql.validate.SqlValidatorScope
SqlValidatorScope.EmptyPath, SqlValidatorScope.Path, SqlValidatorScope.Resolve, SqlValidatorScope.Resolved, SqlValidatorScope.ResolvedImpl, SqlValidatorScope.Step
-
-
Field Summary
Fields Modifier and Type Field Description private SqlWithItem
withItem
-
Fields inherited from class org.apache.calcite.sql.validate.DelegatingScope
parent, validator
-
-
Constructor Summary
Constructors Constructor Description WithScope(SqlValidatorScope parent, SqlWithItem withItem)
Creates a WithScope.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SqlNode
getNode()
Returns the root node of this scope.SqlValidatorNamespace
getTableNamespace(java.util.List<java.lang.String> names)
void
resolve(java.util.List<java.lang.String> names, SqlNameMatcher nameMatcher, boolean deep, SqlValidatorScope.Resolved resolved)
Looks up a node with a given name.void
resolveTable(java.util.List<java.lang.String> names, SqlNameMatcher nameMatcher, SqlValidatorScope.Path path, SqlValidatorScope.Resolved resolved)
Looks up a table in this scope from its name.-
Methods inherited from class org.apache.calcite.sql.validate.ListScope
addChild, findAliases, findAllColumnNames, findQualifyingTableName, findQualifyingTableNames, getChildNames, getChildren, resolveColumn
-
Methods inherited from class org.apache.calcite.sql.validate.DelegatingScope
addColumnNames, fullyQualify, getMonotonicity, getOperandScope, getOrderList, getParent, getValidator, lookupWindow, nullifyType, resolveInNamespace, validateExpr
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.calcite.sql.validate.SqlValidatorScope
isWithin
-
-
-
-
Field Detail
-
withItem
private final SqlWithItem withItem
-
-
Constructor Detail
-
WithScope
WithScope(SqlValidatorScope parent, SqlWithItem withItem)
Creates a WithScope.
-
-
Method Detail
-
getNode
public SqlNode getNode()
Description copied from interface:SqlValidatorScope
Returns the root node of this scope. Never null.
-
getTableNamespace
public SqlValidatorNamespace getTableNamespace(java.util.List<java.lang.String> names)
- Specified by:
getTableNamespace
in interfaceSqlValidatorScope
- Overrides:
getTableNamespace
in classDelegatingScope
-
resolveTable
public void resolveTable(java.util.List<java.lang.String> names, SqlNameMatcher nameMatcher, SqlValidatorScope.Path path, SqlValidatorScope.Resolved resolved)
Description copied from interface:SqlValidatorScope
Looks up a table in this scope from its name. If found, callsSqlValidatorScope.resolve(List, SqlNameMatcher, boolean, Resolved)
.TableNamespace
that wraps it. If the "table" is defined in aWITH
clause it may be a query, not a table after all.The name matcher is not null, and one typically uses
SqlValidatorCatalogReader.nameMatcher()
.- Specified by:
resolveTable
in interfaceSqlValidatorScope
- Overrides:
resolveTable
in classDelegatingScope
- Parameters:
names
- Name of table, may be qualified or fully-qualifiednameMatcher
- Name matcherpath
- List of names that we have traversed through so far
-
resolve
public void resolve(java.util.List<java.lang.String> names, SqlNameMatcher nameMatcher, boolean deep, SqlValidatorScope.Resolved resolved)
Description copied from interface:SqlValidatorScope
Looks up a node with a given name. Returns null if none is found.- Specified by:
resolve
in interfaceSqlValidatorScope
- Overrides:
resolve
in classListScope
- Parameters:
names
- Name of node to find, maybe partially or fully qualifiednameMatcher
- Name matcherdeep
- Whether to look more than one level deepresolved
- Callback wherein to write the match(es) we find
-
-