Package org.apache.calcite.sql.validate
Class SelectScope
java.lang.Object
org.apache.calcite.sql.validate.DelegatingScope
org.apache.calcite.sql.validate.ListScope
org.apache.calcite.sql.validate.SelectScope
- All Implemented Interfaces:
SqlValidatorScope
The name-resolution scope of a SELECT clause. The objects visible are those
in the FROM clause, and objects inherited from the parent scope.
This object is both a SqlValidatorScope and a
SqlValidatorNamespace. In the query
SELECT name FROM (
SELECT *
FROM emp
WHERE gender = 'F')
we need to use the SelectScope as a
SqlValidatorNamespace when resolving 'name', and
as a SqlValidatorScope when resolving 'gender'.
Scopes
In the query
SELECT expr1
FROM t1,
t2,
(SELECT expr2 FROM t3) AS q3
WHERE c1 IN (SELECT expr3 FROM t4)
ORDER BY expr4
The scopes available at various points of the query are as follows:
- expr1 can see t1, t2, q3
- expr2 can see t3
- expr3 can see t4, t1, t2
- expr4 can see t1, t2, q3, plus (depending upon the dialect) any aliases defined in the SELECT clause
Namespaces
In the above query, there are 4 namespaces:
- t1
- t2
- (SELECT expr2 FROM t3) AS q3
- (SELECT expr3 FROM t4)
- See Also:
-
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
FieldsFields inherited from class org.apache.calcite.sql.validate.DelegatingScope
parent, resolved, validator -
Method Summary
Modifier and TypeMethodDescriptionvoidaddWindowName(String winName) booleanexistingWindowName(String winName) getMonotonicity(SqlNode expr) Returns whether an expression is monotonic in this scope.getNode()Returns the root node of this scope.Returns the expressions by which the rows in this scope are sorted.@Nullable SqlValidatorTablegetTable()@Nullable SqlWindowlookupWindow(String name) Finds a window with a given name.voidsetExpandedSelectList(@Nullable List<SqlNode> selectList) Methods inherited from class org.apache.calcite.sql.validate.ListScope
addChild, findAliases, findAllColumnNames, findQualifyingTableName, findQualifyingTableNames, getChildren, isChildNullable, resolve, resolveColumnMethods inherited from class org.apache.calcite.sql.validate.DelegatingScope
addColumnNames, analyze, fullyQualify, getOperandScope, getParent, getTableNamespace, getValidator, nullifyType, qualifyUsingAlias, resolveTable, validateExprMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.calcite.sql.validate.SqlValidatorScope
isMeasureRef, isWithin
-
Field Details
-
windowNames
-
-
Method Details
-
getTable
-
getNode
Description copied from interface:SqlValidatorScopeReturns the root node of this scope. Never null. -
lookupWindow
Description copied from interface:SqlValidatorScopeFinds a window with a given name. Returns null if not found.- Specified by:
lookupWindowin interfaceSqlValidatorScope- Overrides:
lookupWindowin classDelegatingScope
-
getMonotonicity
Description copied from interface:SqlValidatorScopeReturns whether an expression is monotonic in this scope. For example, if the scope has previously been sorted by columns X, Y, then X is monotonic in this scope, but Y is not.- Specified by:
getMonotonicityin interfaceSqlValidatorScope- Overrides:
getMonotonicityin classDelegatingScope
-
getOrderList
Description copied from interface:SqlValidatorScopeReturns the expressions by which the rows in this scope are sorted. If the rows are unsorted, returns null.- Specified by:
getOrderListin interfaceSqlValidatorScope- Overrides:
getOrderListin classDelegatingScope
-
addWindowName
-
existingWindowName
-
getExpandedSelectList
-
setExpandedSelectList
-