Package org.apache.calcite.adapter.jdbc
Class JdbcCatalogSchema
java.lang.Object
org.apache.calcite.schema.impl.AbstractSchema
org.apache.calcite.adapter.jdbc.JdbcCatalogSchema
Schema based upon a JDBC catalog (database).
This schema does not directly contain tables, but contains a sub-schema
for each schema in the catalog in the back-end. Each of those sub-schemas is
an instance of JdbcSchema
.
This schema is lazy: it does not compute the list of schema names until
the first call to getSubSchemaMap()
. Then it creates a
JdbcSchema
for each schema name. Each JdbcSchema will populate its
tables on demand.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.calcite.schema.impl.AbstractSchema
AbstractSchema.Factory
Nested classes/interfaces inherited from interface org.apache.calcite.schema.Schema
Schema.TableType
-
Field Summary
-
Constructor Summary
ConstructorDescriptionJdbcCatalogSchema
(DataSource dataSource, SqlDialect dialect, JdbcConvention convention, String catalog) Creates a JdbcCatalogSchema. -
Method Summary
Modifier and TypeMethodDescriptionstatic JdbcCatalogSchema
create
(@Nullable SchemaPlus parentSchema, String name, DataSource dataSource, String catalog) static JdbcCatalogSchema
create
(@Nullable SchemaPlus parentSchema, String name, DataSource dataSource, SqlDialectFactory dialectFactory, String catalog) Returns the data source.@Nullable String
Returns the name of the default sub-schema.Returns a map of sub-schemas in this schema by name.<T> @Nullable T
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.schema.impl.AbstractSchema
getExpression, getFunctionMultimap, getFunctionNames, getFunctions, getSubSchema, getSubSchemaNames, getTable, getTableMap, getTableNames, getType, getTypeMap, getTypeNames, isMutable, snapshot
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.Wrapper
maybeUnwrap, unwrapOrThrow
-
Field Details
-
dialect
-
-
Constructor Details
-
JdbcCatalogSchema
public JdbcCatalogSchema(DataSource dataSource, SqlDialect dialect, JdbcConvention convention, String catalog) Creates a JdbcCatalogSchema.
-
-
Method Details
-
create
public static JdbcCatalogSchema create(@Nullable SchemaPlus parentSchema, String name, DataSource dataSource, String catalog) -
create
public static JdbcCatalogSchema create(@Nullable SchemaPlus parentSchema, String name, DataSource dataSource, SqlDialectFactory dialectFactory, String catalog) -
getSubSchemaMap
Description copied from class:AbstractSchema
Returns a map of sub-schemas in this schema by name.The implementations of
AbstractSchema.getSubSchemaNames()
andAbstractSchema.getSubSchema(String)
depend on this map. The default implementation of this method returns the empty map. Override this method to change their behavior.- Overrides:
getSubSchemaMap
in classAbstractSchema
- Returns:
- Map of sub-schemas in this schema by name
-
getDefaultSubSchemaName
Returns the name of the default sub-schema. -
getDataSource
Returns the data source. -
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.
-