Package org.apache.calcite.adapter.jdbc
Class JdbcTable
java.lang.Object
org.apache.calcite.schema.impl.AbstractTable
org.apache.calcite.adapter.java.AbstractQueryableTable
org.apache.calcite.adapter.jdbc.JdbcTable
- All Implemented Interfaces:
ModifiableTable,QueryableTable,ScannableTable,Table,TranslatableTable,Wrapper
public class JdbcTable
extends AbstractQueryableTable
implements TranslatableTable, ScannableTable, ModifiableTable
Queryable that gets its data from a table within a JDBC connection.
The idea is not to read the whole table, however. The idea is to use
this as a building block for a query, by applying Queryable operators
such as
ExtendedEnumerable.where(org.apache.calcite.linq4j.function.Predicate2).
The resulting queryable can then be converted to a SQL query, which can be
executed efficiently on the JDBC server.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal Stringfinal JdbcSchemafinal Stringfinal Stringfinal Schema.TableTypeFields inherited from class org.apache.calcite.adapter.java.AbstractQueryableTable
elementType -
Method Summary
Modifier and TypeMethodDescription<T> Queryable<T>asQueryable(QueryProvider queryProvider, SchemaPlus schema, String tableName) Converts this table into aQueryable.Type of table.@Nullable CollectionReturns the modifiable collection.getRowType(RelDataTypeFactory typeFactory) Returns this table's row type.Enumerable<@Nullable Object[]>scan(DataContext root) Returns an enumerator over the rows in this Table.Returns the table name, qualified with catalog and schema name if applicable, as a parse tree node (SqlIdentifier).toModificationRel(RelOptCluster cluster, RelOptTable table, Prepare.CatalogReader catalogReader, RelNode input, TableModify.Operation operation, @Nullable List<String> updateColumnList, @Nullable List<RexNode> sourceExpressionList, boolean flattened) Creates a relational expression that modifies this table.toRel(RelOptTable.ToRelContext context, RelOptTable relOptTable) Converts this table into arelational expression.toString()<C> @Nullable CFinds an instance of an interface implemented by this object, or returns null if this object does not support that interface.Methods inherited from class org.apache.calcite.adapter.java.AbstractQueryableTable
getElementType, getExpressionMethods inherited from class org.apache.calcite.schema.impl.AbstractTable
getStatistic, isRolledUp, rolledUpColumnValidInsideAggMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.calcite.schema.QueryableTable
getElementType, getExpressionMethods inherited from interface org.apache.calcite.schema.Table
getStatistic, isRolledUp, rolledUpColumnValidInsideAggMethods inherited from interface org.apache.calcite.schema.Wrapper
maybeUnwrap, unwrapOrThrow
-
Field Details
-
jdbcSchema
-
jdbcCatalogName
-
jdbcSchemaName
-
jdbcTableName
-
jdbcTableType
-
-
Method Details
-
toString
-
getJdbcTableType
Description copied from interface:TableType of table.- Specified by:
getJdbcTableTypein interfaceTable- Overrides:
getJdbcTableTypein classAbstractTable
-
unwrap
Description copied from interface:WrapperFinds an instance of an interface implemented by this object, or returns null if this object does not support that interface.- Specified by:
unwrapin interfaceWrapper- Overrides:
unwrapin classAbstractTable
-
getRowType
Description copied from interface:TableReturns 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:
getRowTypein interfaceTable- Parameters:
typeFactory- Type factory with which to create the type- Returns:
- Row type
-
tableName
Returns the table name, qualified with catalog and schema name if applicable, as a parse tree node (SqlIdentifier). -
toRel
Description copied from interface:TranslatableTableConverts this table into arelational expression.- Specified by:
toRelin interfaceTranslatableTable
-
asQueryable
public <T> Queryable<T> asQueryable(QueryProvider queryProvider, SchemaPlus schema, String tableName) Description copied from interface:QueryableTableConverts this table into aQueryable.- Specified by:
asQueryablein interfaceQueryableTable
-
scan
Description copied from interface:ScannableTableReturns an enumerator over the rows in this Table. Each row is represented as an array of its column values.- Specified by:
scanin interfaceScannableTable
-
getModifiableCollection
Description copied from interface:ModifiableTableReturns the modifiable collection. Modifying the collection will change the table's contents.- Specified by:
getModifiableCollectionin interfaceModifiableTable
-
toModificationRel
public TableModify toModificationRel(RelOptCluster cluster, RelOptTable table, Prepare.CatalogReader catalogReader, RelNode input, TableModify.Operation operation, @Nullable List<String> updateColumnList, @Nullable List<RexNode> sourceExpressionList, boolean flattened) Description copied from interface:ModifiableTableCreates a relational expression that modifies this table.- Specified by:
toModificationRelin interfaceModifiableTable
-