Package org.apache.calcite.sql.validate
Class TableNamespace
- java.lang.Object
-
- org.apache.calcite.sql.validate.AbstractNamespace
-
- org.apache.calcite.sql.validate.TableNamespace
-
- All Implemented Interfaces:
SqlValidatorNamespace
class TableNamespace extends AbstractNamespace
Namespace based on a table from the catalog.
-
-
Field Summary
Fields Modifier and Type Field Description com.google.common.collect.ImmutableList<RelDataTypeField>
extendedFields
private SqlValidatorTable
table
-
Fields inherited from class org.apache.calcite.sql.validate.AbstractNamespace
enclosingNode, rowType, type, validator
-
-
Constructor Summary
Constructors Modifier Constructor Description (package private)
TableNamespace(SqlValidatorImpl validator, SqlValidatorTable table)
private
TableNamespace(SqlValidatorImpl validator, SqlValidatorTable table, java.util.List<RelDataTypeField> fields)
Creates a TableNamespace.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
checkExtendedColumnTypes(SqlNodeList extendList)
Ensures that extended columns that have the same name as a base column also have the same data-type.TableNamespace
extend(SqlNodeList extendList)
Creates a TableNamespace based on the same table as this one, but with extended fields.private RelDataType
getBaseRowType()
Gets the data-type of all columns in a table (for a view table: including columns of the underlying table)SqlMonotonicity
getMonotonicity(java.lang.String columnName)
Returns whether and how a given column is sorted.SqlNode
getNode()
Returns the parse tree node at the root of this namespace.SqlValidatorTable
getTable()
Returns the underlying table, or null if there is none.protected RelDataType
validateImpl(RelDataType targetRowType)
Validates this scope and returns the type of the records it returns.-
Methods inherited from class org.apache.calcite.sql.validate.AbstractNamespace
convertToStruct, fieldExists, getEnclosingNode, getMonotonicExprs, getRowType, getRowTypeSansSystemColumns, getType, getValidator, isWrapperFor, lookupChild, makeNullable, resolve, setType, supportsModality, toStruct, translate, unwrap, validate
-
-
-
-
Field Detail
-
table
private final SqlValidatorTable table
-
extendedFields
public final com.google.common.collect.ImmutableList<RelDataTypeField> extendedFields
-
-
Constructor Detail
-
TableNamespace
private TableNamespace(SqlValidatorImpl validator, SqlValidatorTable table, java.util.List<RelDataTypeField> fields)
Creates a TableNamespace.
-
TableNamespace
TableNamespace(SqlValidatorImpl validator, SqlValidatorTable table)
-
-
Method Detail
-
validateImpl
protected RelDataType validateImpl(RelDataType targetRowType)
Description copied from class:AbstractNamespace
Validates this scope and returns the type of the records it returns. External users should callAbstractNamespace.validate(org.apache.calcite.rel.type.RelDataType)
, which uses theAbstractNamespace.status
field to protect against cycles.- Specified by:
validateImpl
in classAbstractNamespace
- Parameters:
targetRowType
- Desired row type, must not be null, may be the data type 'unknown'.- Returns:
- record data type, never null
-
getNode
public SqlNode getNode()
Description copied from interface:SqlValidatorNamespace
Returns the parse tree node at the root of this namespace.- Returns:
- parse tree node; null for
TableNamespace
-
getTable
public SqlValidatorTable getTable()
Description copied from interface:SqlValidatorNamespace
Returns the underlying table, or null if there is none.- Specified by:
getTable
in interfaceSqlValidatorNamespace
- Overrides:
getTable
in classAbstractNamespace
-
getMonotonicity
public SqlMonotonicity getMonotonicity(java.lang.String columnName)
Description copied from interface:SqlValidatorNamespace
Returns whether and how a given column is sorted.- Specified by:
getMonotonicity
in interfaceSqlValidatorNamespace
- Overrides:
getMonotonicity
in classAbstractNamespace
-
extend
public TableNamespace extend(SqlNodeList extendList)
Creates a TableNamespace based on the same table as this one, but with extended fields.Extended fields are "hidden" or undeclared fields that may nevertheless be present if you ask for them. Phoenix uses them, for instance, to access rarely used fields in the underlying HBase table.
-
getBaseRowType
private RelDataType getBaseRowType()
Gets the data-type of all columns in a table (for a view table: including columns of the underlying table)
-
checkExtendedColumnTypes
private void checkExtendedColumnTypes(SqlNodeList extendList)
Ensures that extended columns that have the same name as a base column also have the same data-type.
-
-