|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface SqlValidatorNamespace
A namespace describes the relation returned by a section of a SQL query.
For example, in the query SELECT emp.deptno, age FROM emp,
dept
, the FROM clause forms a namespace consisting of two tables EMP
and DEPT, and a row type consisting of the combined columns of those tables.
Other examples of namespaces include a table in the from list (the namespace contains the constituent columns) and a subquery (the namespace contains the columns in the SELECT clause of the subquery).
These various kinds of namespace are implemented by classes IdentifierNamespace
for table names, SelectNamespace
for SELECT
queries, SetopNamespace
for UNION, EXCEPT and INTERSECT, and so
forth. But if you are looking at a SELECT query and call SqlValidator.getNamespace(org.eigenbase.sql.SqlNode)
, you may not get a
SelectNamespace. Why? Because the validator is allowed to wrap namespaces in
other objects which implement SqlValidatorNamespace
. Your
SelectNamespace will be there somewhere, but might be one or two levels deep.
Don't try to cast the namespace or use instanceof
; use unwrap(Class)
and isWrapperFor(Class)
instead.
SqlValidator
,
SqlValidatorScope
Method Summary | ||
---|---|---|
boolean |
fieldExists(String name)
Returns whether this namespace has a field of a given name. |
|
SqlNode |
getEnclosingNode()
Returns the parse tree node that at is at the root of this namespace and includes all decorations. |
|
List<Pair<SqlNode,SqlMonotonicity>> |
getMonotonicExprs()
Returns a list of expressions which are monotonic in this namespace. |
|
SqlMonotonicity |
getMonotonicity(String columnName)
Returns whether and how a given column is sorted. |
|
SqlNode |
getNode()
Returns the parse tree node at the root of this namespace. |
|
RelDataType |
getRowType()
Returns the row type of this namespace, which comprises a list of names and types of the output columns. |
|
RelDataType |
getRowTypeSansSystemColumns()
Returns the row type of this namespace, sans any system columns. |
|
SqlValidatorTable |
getTable()
Returns the underlying table, or null if there is none. |
|
SqlValidator |
getValidator()
Returns the validator. |
|
boolean |
isWrapperFor(Class<?> clazz)
Returns whether this namespace implements a given interface, or wraps a class which does. |
|
SqlValidatorNamespace |
lookupChild(String name)
Looks up a child namespace of a given name. |
|
void |
makeNullable()
Makes all fields in this namespace nullable (typically because it is on the outer side of an outer join. |
|
void |
setRowType(RelDataType rowType)
Allows RowType for the namespace to be explicitly set. |
|
String |
translate(String name)
Translates a field name to the name in the underlying namespace. |
|
|
unwrap(Class<T> clazz)
Returns this namespace, or a wrapped namespace, cast to a particular class. |
|
void |
validate()
Validates this namespace. |
Method Detail |
---|
SqlValidator getValidator()
SqlValidatorTable getTable()
RelDataType getRowType()
void setRowType(RelDataType rowType)
RelDataType getRowTypeSansSystemColumns()
void validate()
If the scope has already been validated, does nothing.
Please call SqlValidatorImpl.validateNamespace(org.eigenbase.sql.validate.SqlValidatorNamespace)
rather than
calling this method directly.
SqlNode getNode()
SqlNode getEnclosingNode()
getNode()
.
SqlValidatorNamespace lookupChild(String name)
For example, in the query select e.name from emps as e
,
e
is an IdentifierNamespace
which has a child
name
which is a FieldNamespace
.
name
- Name of namespace
boolean fieldExists(String name)
name
- Field name
List<Pair<SqlNode,SqlMonotonicity>> getMonotonicExprs()
SqlIdentifier
called "TIMESTAMP".
SqlMonotonicity getMonotonicity(String columnName)
void makeNullable()
String translate(String name)
<T> T unwrap(Class<T> clazz)
clazz
- Desired type
ClassCastException
- if no such interface is availableboolean isWrapperFor(Class<?> clazz)
clazz
- Interface
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |