public class SelectScope extends ListScope
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'.
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:
In the above query, there are 4 namespaces:
SelectNamespaceSqlValidatorScope.EmptyPath, SqlValidatorScope.Path, SqlValidatorScope.Resolve, SqlValidatorScope.Resolved, SqlValidatorScope.ResolvedImpl, SqlValidatorScope.Step| Modifier and Type | Field and Description |
|---|---|
private List<SqlNode> |
expandedSelectList |
private SqlNodeList |
orderList
List of column names which sort this scope.
|
private SqlSelect |
select |
protected List<String> |
windowNames |
private SqlValidatorScope |
windowParent
Scope to use to resolve windows
|
parent, validator| Constructor and Description |
|---|
SelectScope(SqlValidatorScope parent,
SqlValidatorScope winParent,
SqlSelect select)
Creates a scope corresponding to a SELECT clause.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addWindowName(String winName) |
boolean |
existingWindowName(String winName) |
List<SqlNode> |
getExpandedSelectList() |
SqlMonotonicity |
getMonotonicity(SqlNode expr)
Returns whether an expression is monotonic in this scope.
|
SqlSelect |
getNode()
Returns the root node of this scope.
|
SqlNodeList |
getOrderList()
Returns the expressions by which the rows in this scope are sorted.
|
SqlValidatorTable |
getTable() |
SqlWindow |
lookupWindow(String name)
Finds a window with a given name.
|
void |
setExpandedSelectList(List<SqlNode> selectList) |
addChild, findAliases, findAllColumnNames, findQualifyingTableName, findQualifyingTableNames, getChildNames, getChildren, resolve, resolveColumnaddColumnNames, fullyQualify, getOperandScope, getParent, getTableNamespace, getValidator, nullifyType, resolveInNamespace, resolveTable, validateExprprivate final SqlSelect select
private SqlNodeList orderList
private final SqlValidatorScope windowParent
SelectScope(SqlValidatorScope parent, SqlValidatorScope winParent, SqlSelect select)
parent - Parent scope, must not be nullwinParent - Scope for window parent, may be nullselect - Select clausepublic SqlValidatorTable getTable()
public SqlSelect getNode()
SqlValidatorScopepublic SqlWindow lookupWindow(String name)
SqlValidatorScopelookupWindow in interface SqlValidatorScopelookupWindow in class DelegatingScopepublic SqlMonotonicity getMonotonicity(SqlNode expr)
SqlValidatorScopegetMonotonicity in interface SqlValidatorScopegetMonotonicity in class DelegatingScopepublic SqlNodeList getOrderList()
SqlValidatorScopegetOrderList in interface SqlValidatorScopegetOrderList in class DelegatingScopepublic void addWindowName(String winName)
public boolean existingWindowName(String winName)
Copyright © 2012–2018 The Apache Software Foundation. All rights reserved.