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
Modifier and TypeFieldDescriptionfinal String
final JdbcSchema
final String
final String
final Schema.TableType
Fields 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 Collection
Returns 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 C
Finds 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, getExpression
Methods inherited from class org.apache.calcite.schema.impl.AbstractTable
getStatistic, isRolledUp, rolledUpColumnValidInsideAgg
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.calcite.schema.QueryableTable
getElementType, getExpression
Methods inherited from interface org.apache.calcite.schema.Table
getStatistic, isRolledUp, rolledUpColumnValidInsideAgg
Methods 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:Table
Type of table.- Specified by:
getJdbcTableType
in interfaceTable
- Overrides:
getJdbcTableType
in classAbstractTable
-
unwrap
Description copied from interface:Wrapper
Finds an instance of an interface implemented by this object, or returns null if this object does not support that interface.- Specified by:
unwrap
in interfaceWrapper
- Overrides:
unwrap
in classAbstractTable
-
getRowType
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
-
tableName
Returns the table name, qualified with catalog and schema name if applicable, as a parse tree node (SqlIdentifier
). -
toRel
Description copied from interface:TranslatableTable
Converts this table into arelational expression
.- Specified by:
toRel
in interfaceTranslatableTable
-
asQueryable
public <T> Queryable<T> asQueryable(QueryProvider queryProvider, SchemaPlus schema, String tableName) Description copied from interface:QueryableTable
Converts this table into aQueryable
.- Specified by:
asQueryable
in interfaceQueryableTable
-
scan
Description copied from interface:ScannableTable
Returns an enumerator over the rows in this Table. Each row is represented as an array of its column values.- Specified by:
scan
in interfaceScannableTable
-
getModifiableCollection
Description copied from interface:ModifiableTable
Returns the modifiable collection. Modifying the collection will change the table's contents.- Specified by:
getModifiableCollection
in 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:ModifiableTable
Creates a relational expression that modifies this table.- Specified by:
toModificationRel
in interfaceModifiableTable
-