Package org.apache.calcite.schema.impl
Class ViewTable
- java.lang.Object
-
- org.apache.calcite.schema.impl.AbstractTable
-
- org.apache.calcite.adapter.java.AbstractQueryableTable
-
- org.apache.calcite.schema.impl.ViewTable
-
- All Implemented Interfaces:
QueryableTable
,Table
,TranslatableTable
,Wrapper
- Direct Known Subclasses:
MaterializedViewTable
,ModifiableViewTable
public class ViewTable extends AbstractQueryableTable implements TranslatableTable
Table whose contents are defined using an SQL statement.It is not evaluated; it is expanded during query planning.
-
-
Field Summary
Fields Modifier and Type Field Description private RelProtoDataType
protoRowType
private java.util.List<java.lang.String>
schemaPath
private java.util.List<java.lang.String>
viewPath
private java.lang.String
viewSql
-
Fields inherited from class org.apache.calcite.adapter.java.AbstractQueryableTable
elementType
-
-
Constructor Summary
Constructors Constructor Description ViewTable(java.lang.reflect.Type elementType, RelProtoDataType rowType, java.lang.String viewSql, java.util.List<java.lang.String> schemaPath, java.util.List<java.lang.String> viewPath)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description <T> Queryable<T>
asQueryable(QueryProvider queryProvider, SchemaPlus schema, java.lang.String tableName)
Converts this table into aQueryable
.private RelRoot
expandView(RelOptTable.ToRelContext context, RelDataType rowType, java.lang.String queryString)
Schema.TableType
getJdbcTableType()
Type of table.RelDataType
getRowType(RelDataTypeFactory typeFactory)
Returns this table's row type.java.util.List<java.lang.String>
getSchemaPath()
Returns the the schema path of the view.java.util.List<java.lang.String>
getViewPath()
Returns the the path of the view.java.lang.String
getViewSql()
Returns the view's SQL definition.RelNode
toRel(RelOptTable.ToRelContext context, RelOptTable relOptTable)
Converts this table into arelational expression
.static ViewTableMacro
viewMacro(SchemaPlus schema, java.lang.String viewSql, java.util.List<java.lang.String> schemaPath)
Deprecated.static ViewTableMacro
viewMacro(SchemaPlus schema, java.lang.String viewSql, java.util.List<java.lang.String> schemaPath, java.lang.Boolean modifiable)
Deprecated.static ViewTableMacro
viewMacro(SchemaPlus schema, java.lang.String viewSql, java.util.List<java.lang.String> schemaPath, java.util.List<java.lang.String> viewPath, java.lang.Boolean modifiable)
Table macro that returns a view.-
Methods inherited from class org.apache.calcite.adapter.java.AbstractQueryableTable
getElementType, getExpression
-
Methods inherited from class org.apache.calcite.schema.impl.AbstractTable
getStatistic, isRolledUp, rolledUpColumnValidInsideAgg, unwrap
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.calcite.schema.Table
getStatistic, isRolledUp, rolledUpColumnValidInsideAgg
-
-
-
-
Field Detail
-
viewSql
private final java.lang.String viewSql
-
schemaPath
private final java.util.List<java.lang.String> schemaPath
-
protoRowType
private final RelProtoDataType protoRowType
-
viewPath
private final java.util.List<java.lang.String> viewPath
-
-
Constructor Detail
-
ViewTable
public ViewTable(java.lang.reflect.Type elementType, RelProtoDataType rowType, java.lang.String viewSql, java.util.List<java.lang.String> schemaPath, java.util.List<java.lang.String> viewPath)
-
-
Method Detail
-
viewMacro
@Deprecated public static ViewTableMacro viewMacro(SchemaPlus schema, java.lang.String viewSql, java.util.List<java.lang.String> schemaPath)
Deprecated.
-
viewMacro
@Deprecated public static ViewTableMacro viewMacro(SchemaPlus schema, java.lang.String viewSql, java.util.List<java.lang.String> schemaPath, java.lang.Boolean modifiable)
Deprecated.
-
viewMacro
public static ViewTableMacro viewMacro(SchemaPlus schema, java.lang.String viewSql, java.util.List<java.lang.String> schemaPath, java.util.List<java.lang.String> viewPath, java.lang.Boolean modifiable)
Table macro that returns a view.- Parameters:
schema
- Schema the view will belong toviewSql
- SQL queryschemaPath
- Path of schemamodifiable
- Whether view is modifiable, or null to deduce it
-
getViewSql
public java.lang.String getViewSql()
Returns the view's SQL definition.
-
getSchemaPath
public java.util.List<java.lang.String> getSchemaPath()
Returns the the schema path of the view.
-
getViewPath
public java.util.List<java.lang.String> getViewPath()
Returns the the path of the view.
-
getJdbcTableType
public Schema.TableType getJdbcTableType()
Description copied from interface:Table
Type of table.- Specified by:
getJdbcTableType
in interfaceTable
- Overrides:
getJdbcTableType
in classAbstractTable
-
getRowType
public RelDataType getRowType(RelDataTypeFactory typeFactory)
Description copied from interface:Table
Returns this table's row type.This is a struct type whose fields describe the names and types of the columns in this table.
The implementer must use the type factory provided. This ensures that the type is converted into a canonical form; other equal types in the same query will use the same object.
- Specified by:
getRowType
in interfaceTable
- Parameters:
typeFactory
- Type factory with which to create the type- Returns:
- Row type
-
asQueryable
public <T> Queryable<T> asQueryable(QueryProvider queryProvider, SchemaPlus schema, java.lang.String tableName)
Description copied from interface:QueryableTable
Converts this table into aQueryable
.- Specified by:
asQueryable
in interfaceQueryableTable
-
toRel
public RelNode toRel(RelOptTable.ToRelContext context, RelOptTable relOptTable)
Description copied from interface:TranslatableTable
Converts this table into arelational expression
.- Specified by:
toRel
in interfaceTranslatableTable
-
expandView
private RelRoot expandView(RelOptTable.ToRelContext context, RelDataType rowType, java.lang.String queryString)
-
-