class FieldNamespace extends AbstractNamespace
SqlValidatorNamespace for a field of a record.
A field is not a very interesting namespace - except if the field has a record or multiset type - but this class exists to make fields behave similarly to other records for purposes of name resolution.
enclosingNode, rowType, type, validator| Constructor and Description |
|---|
FieldNamespace(SqlValidatorImpl validator,
RelDataType dataType)
Creates a FieldNamespace.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
fieldExists(String name)
Returns whether this namespace has a field of a given name.
|
SqlNode |
getNode()
Returns the parse tree node at the root of this namespace.
|
SqlValidatorNamespace |
lookupChild(String name)
Looks up a child namespace of a given name.
|
void |
setType(RelDataType type)
Sets the type of this namespace.
|
protected RelDataType |
validateImpl(RelDataType targetRowType)
Validates this scope and returns the type of the records it returns.
|
convertToStruct, getEnclosingNode, getMonotonicExprs, getMonotonicity, getRowType, getRowTypeSansSystemColumns, getTable, getType, getValidator, isWrapperFor, makeNullable, resolve, supportsModality, toStruct, translate, unwrap, validateFieldNamespace(SqlValidatorImpl validator, RelDataType dataType)
validator - ValidatordataType - Data type of fieldpublic void setType(RelDataType type)
SqlValidatorNamespaceAllows the type for the namespace to be explicitly set, but usually is
called during SqlValidatorNamespace.validate(RelDataType).
Implicitly also sets the row type. If the type is not a struct, then the row type is the type wrapped as a struct with a single column, otherwise the type and row type are the same.
setType in interface SqlValidatorNamespacesetType in class AbstractNamespaceprotected RelDataType validateImpl(RelDataType targetRowType)
AbstractNamespaceAbstractNamespace.validate(org.apache.calcite.rel.type.RelDataType), which uses the
AbstractNamespace.status field to protect against cycles.validateImpl in class AbstractNamespacetargetRowType - Desired row type, must not be null, may be the data
type 'unknown'.public SqlNode getNode()
SqlValidatorNamespaceTableNamespacepublic SqlValidatorNamespace lookupChild(String name)
SqlValidatorNamespaceFor example, in the query select e.name from emps as e,
e is an IdentifierNamespace which has a child
name which is a FieldNamespace.
lookupChild in interface SqlValidatorNamespacelookupChild in class AbstractNamespacename - Name of namespacepublic boolean fieldExists(String name)
SqlValidatorNamespacefieldExists in interface SqlValidatorNamespacefieldExists in class AbstractNamespacename - Field nameCopyright © 2012–2018 The Apache Software Foundation. All rights reserved.