Class SelectNamespace
- All Implemented Interfaces:
- SqlValidatorNamespace
- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected final @Nullable SqlNodeprotected FilterRequirementInformation about what fields need to be filtered and what bypass fields can defuse the errors if they are filtered on as an alternative.protected @Nullable RelDataTypeType of the output row, which comprises the name and type of each output column.protected @Nullable RelDataTypeAsrowType, but not necessarily a struct.protected final SqlValidatorImpl
- 
Constructor SummaryConstructorsConstructorDescriptionSelectNamespace(SqlValidatorImpl validator, SqlSelect select, SqlNode enclosingNode) Creates a SelectNamespace.
- 
Method SummaryModifier and TypeMethodDescriptionprotected RelDataTypeconvertToStruct(RelDataType type) @Nullable RelDataTypeFieldReturns a field of a given name, or null.@Nullable SqlNodeReturns the parse tree node that at is at the root of this namespace and includes all decorations.Returns aFilterRequirementobject describing the "must-filter" fields of this namespace (fields that must be filtered in a query) and "bypass" fields that can remove the requirement that fields are filtered.Returns a list of expressions which are monotonic in this namespace.getMonotonicity(String columnName) Returns whether and how a given column is sorted.getNode()Returns the parse tree node at the root of this namespace.Returns the row type of this namespace, which comprises a list of names and types of the output columns.Returns the row type of this namespace, sans any system columns.@Nullable SqlValidatorTablegetTable()Returns the underlying table, or null if there is none.getType()Returns the type of this namespace.Returns the validator.booleanisWrapperFor(Class<?> clazz) Returns whether this namespace implements a given interface, or wraps a class which does.@Nullable SqlValidatorNamespacelookupChild(String name) Looks up a child namespace of a given name.voidresolve()If this namespace resolves to another namespace, returns that namespace, following links to the end of the chain.voidsetType(RelDataType type) Sets the type of this namespace.booleansupportsModality(SqlModality modality) Returns whether this namespace is capable of giving results of the desired modality.protected RelDataTypetoStruct(RelDataType type, @Nullable SqlNode unnest) Converts a type to a struct if it is not already.<T> @Nullable TReturns this namespace, or a wrapped namespace, cast to a particular class.final voidvalidate(RelDataType targetRowType) Validates this namespace.validateImpl(RelDataType targetRowType) Validates this scope and returns the type of the records it returns.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.calcite.sql.validate.SqlValidatorNamespacefieldExists
- 
Field Details- 
validator
- 
rowTypeType of the output row, which comprises the name and type of each output column. Set on validate.
- 
typeAsrowType, but not necessarily a struct.
- 
filterRequirementInformation about what fields need to be filtered and what bypass fields can defuse the errors if they are filtered on as an alternative. Initialized as an empty object, but typically re-assigned during validation.
- 
enclosingNode
 
- 
- 
Constructor Details- 
SelectNamespaceCreates a SelectNamespace.- Parameters:
- validator- Validate
- select- Select node
- enclosingNode- Enclosing node
 
 
- 
- 
Method Details- 
getNodeDescription copied from interface:SqlValidatorNamespaceReturns the parse tree node at the root of this namespace.- Returns:
- parse tree node; null for TableNamespace
 
- 
validateImplValidates this scope and returns the type of the records it returns. External users should callSqlValidatorNamespace.validate(org.apache.calcite.rel.type.RelDataType), which uses thestatusfield to protect against cycles.- Parameters:
- targetRowType- Desired row type, must not be null, may be the data type 'unknown'.
- Returns:
- record data type, never null
 
- 
supportsModalityDescription copied from interface:SqlValidatorNamespaceReturns whether this namespace is capable of giving results of the desired modality.truemeans streaming,falsemeans relational.- Specified by:
- supportsModalityin interface- SqlValidatorNamespace
- Parameters:
- modality- Modality
 
- 
getMonotonicityDescription copied from interface:SqlValidatorNamespaceReturns whether and how a given column is sorted.- Specified by:
- getMonotonicityin interface- SqlValidatorNamespace
 
- 
getValidatorDescription copied from interface:SqlValidatorNamespaceReturns the validator.- Specified by:
- getValidatorin interface- SqlValidatorNamespace
- Returns:
- validator
 
- 
validateDescription copied from interface:SqlValidatorNamespaceValidates this namespace.If the scope has already been validated, does nothing. Please call SqlValidatorImpl.validateNamespace(org.apache.calcite.sql.validate.SqlValidatorNamespace, org.apache.calcite.rel.type.RelDataType)rather than calling this method directly.- Specified by:
- validatein interface- SqlValidatorNamespace
- Parameters:
- targetRowType- Desired row type, must not be null, may be the data type 'unknown'.
 
- 
getRowTypeDescription copied from interface:SqlValidatorNamespaceReturns the row type of this namespace, which comprises a list of names and types of the output columns. If the scope's type has not yet been derived, derives it.- Specified by:
- getRowTypein interface- SqlValidatorNamespace
- Returns:
- Row type of this namespace, never null, always a struct
 
- 
getRowTypeSansSystemColumnsDescription copied from interface:SqlValidatorNamespaceReturns the row type of this namespace, sans any system columns.- Specified by:
- getRowTypeSansSystemColumnsin interface- SqlValidatorNamespace
- Returns:
- Row type sans system columns
 
- 
getTypeDescription copied from interface:SqlValidatorNamespaceReturns the type of this namespace.- Specified by:
- getTypein interface- SqlValidatorNamespace
- Returns:
- Row type converted to struct
 
- 
setTypeDescription copied from interface:SqlValidatorNamespaceSets the type of this namespace.Allows 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. - Specified by:
- setTypein interface- SqlValidatorNamespace
 
- 
getEnclosingNodeDescription copied from interface:SqlValidatorNamespaceReturns the parse tree node that at is at the root of this namespace and includes all decorations. If there are no decorations, returns the same asSqlValidatorNamespace.getNode().- Specified by:
- getEnclosingNodein interface- SqlValidatorNamespace
 
- 
getTableDescription copied from interface:SqlValidatorNamespaceReturns the underlying table, or null if there is none.- Specified by:
- getTablein interface- SqlValidatorNamespace
 
- 
lookupChildDescription copied from interface:SqlValidatorNamespaceLooks up a child namespace of a given name.For example, in the query select e.name from emps as e,eis anIdentifierNamespacewhich has a childnamewhich is aFieldNamespace.- Specified by:
- lookupChildin interface- SqlValidatorNamespace
- Parameters:
- name- Name of namespace
- Returns:
- Namespace
 
- 
fieldDescription copied from interface:SqlValidatorNamespaceReturns a field of a given name, or null.- Specified by:
- fieldin interface- SqlValidatorNamespace
- Parameters:
- name- Field name
- Returns:
- Field, or null
 
- 
getMonotonicExprsDescription copied from interface:SqlValidatorNamespaceReturns a list of expressions which are monotonic in this namespace. For example, if the namespace represents a relation ordered by a column called "TIMESTAMP", then the list would contain aSqlIdentifiercalled "TIMESTAMP".- Specified by:
- getMonotonicExprsin interface- SqlValidatorNamespace
 
- 
getFilterRequirementDescription copied from interface:SqlValidatorNamespaceReturns aFilterRequirementobject describing the "must-filter" fields of this namespace (fields that must be filtered in a query) and "bypass" fields that can remove the requirement that fields are filtered.- Specified by:
- getFilterRequirementin interface- SqlValidatorNamespace
 
- 
makeNullablepublic void makeNullable()- Specified by:
- makeNullablein interface- SqlValidatorNamespace
 
- 
translate
- 
resolveDescription copied from interface:SqlValidatorNamespaceIf this namespace resolves to another namespace, returns that namespace, following links to the end of the chain.A WITH) clause defines table names that resolve to queries (the body of the with-item). AnIdentifierNamespacetypically resolves to aTableNamespace.You must not call this method before SqlValidatorNamespace.validate(RelDataType)has completed.- Specified by:
- resolvein interface- SqlValidatorNamespace
 
- 
unwrapDescription copied from interface:SqlValidatorNamespaceReturns this namespace, or a wrapped namespace, cast to a particular class.- Specified by:
- unwrapin interface- SqlValidatorNamespace
- Parameters:
- clazz- Desired type
- Returns:
- This namespace cast to desired type
 
- 
isWrapperForDescription copied from interface:SqlValidatorNamespaceReturns whether this namespace implements a given interface, or wraps a class which does.- Specified by:
- isWrapperForin interface- SqlValidatorNamespace
- Parameters:
- clazz- Interface
- Returns:
- Whether namespace implements given interface
 
- 
convertToStruct
- 
toStructConverts a type to a struct if it is not already.
 
-