Modifier and Type | Class and Description |
---|---|
static class |
CatalogManager.Builder
Builder for a fluent definition of a
CatalogManager . |
static class |
CatalogManager.TableLookupResult
Result of a lookup for a table through
getTable(ObjectIdentifier) . |
Modifier and Type | Method and Description |
---|---|
void |
alterTable(CatalogBaseTable table,
ObjectIdentifier objectIdentifier,
boolean ignoreIfNotExists)
Alters a table in a given fully qualified path.
|
void |
createTable(CatalogBaseTable table,
ObjectIdentifier objectIdentifier,
boolean ignoreIfExists)
Creates a table in a given fully qualified path.
|
void |
createTemporaryTable(CatalogBaseTable table,
ObjectIdentifier objectIdentifier,
boolean ignoreIfExists)
Creates a temporary table in a given fully qualified path.
|
void |
dropTable(ObjectIdentifier objectIdentifier,
boolean ignoreIfNotExists)
Drops a table in a given fully qualified path.
|
void |
dropTemporaryTable(ObjectIdentifier objectIdentifier,
boolean ignoreIfNotExists)
Drop a temporary table in a given fully qualified path.
|
void |
dropTemporaryView(ObjectIdentifier objectIdentifier,
boolean ignoreIfNotExists)
Drop a temporary view in a given fully qualified path.
|
void |
dropView(ObjectIdentifier objectIdentifier,
boolean ignoreIfNotExists)
Drops a view in a given fully qualified path.
|
String |
getBuiltInCatalogName()
Gets the built-in catalog name.
|
String |
getBuiltInDatabaseName()
Gets the built-in database name in the built-in catalog.
|
Optional<Catalog> |
getCatalog(String catalogName)
Gets a catalog by name.
|
String |
getCurrentCatalog()
Gets the current catalog that will be used when resolving table path.
|
String |
getCurrentDatabase()
Gets the current database name that will be used when resolving table path.
|
DataTypeFactory |
getDataTypeFactory()
Returns a factory for creating fully resolved data types that can be used for planning.
|
Optional<CatalogPartition> |
getPartition(ObjectIdentifier tableIdentifier,
CatalogPartitionSpec partitionSpec)
Retrieves a partition with a fully qualified table path and partition spec.
|
SchemaResolver |
getSchemaResolver()
|
Optional<CatalogManager.TableLookupResult> |
getTable(ObjectIdentifier objectIdentifier)
Retrieves a fully qualified table.
|
protected Optional<TemporaryOperationListener> |
getTemporaryOperationListener(ObjectIdentifier identifier) |
void |
initSchemaResolver(boolean isStreamingMode,
ExpressionResolver.ExpressionResolverBuilder expressionResolverBuilder)
Initializes a
SchemaResolver for Schema resolution. |
Set<String> |
listCatalogs()
Retrieves names of all registered catalogs.
|
Set<String> |
listSchemas()
Lists all available schemas in the root of the catalog manager.
|
Set<String> |
listSchemas(String catalogName)
Lists all available schemas in the given catalog.
|
Set<String> |
listTables()
Returns an array of names of all tables (tables and views, both temporary and permanent)
registered in the namespace of the current catalog and database.
|
Set<String> |
listTables(String catalogName,
String databaseName)
Returns an array of names of all tables (tables and views, both temporary and permanent)
registered in the namespace of the current catalog and database.
|
Set<String> |
listTemporaryTables()
Returns an array of names of temporary tables registered in the namespace of the current
catalog and database.
|
Set<String> |
listTemporaryViews()
Returns an array of names of temporary views registered in the namespace of the current
catalog and database.
|
Set<String> |
listViews()
Returns an array of names of all views(both temporary and permanent) registered in the
namespace of the current catalog and database.
|
Set<String> |
listViews(String catalogName,
String databaseName)
Returns an array of names of all views(both temporary and permanent) registered in the
namespace of the current catalog and database.
|
static CatalogManager.Builder |
newBuilder() |
ObjectIdentifier |
qualifyIdentifier(UnresolvedIdentifier identifier)
Returns the full name of the given table path, this name may be padded with current
catalog/database name based on the
identifier's length. |
void |
registerCatalog(String catalogName,
Catalog catalog)
Registers a catalog under the given name.
|
ResolvedCatalogBaseTable<?> |
resolveCatalogBaseTable(CatalogBaseTable baseTable)
Resolves a
CatalogBaseTable to a validated ResolvedCatalogBaseTable . |
ResolvedCatalogTable |
resolveCatalogTable(CatalogTable table)
Resolves a
CatalogTable to a validated ResolvedCatalogTable . |
ResolvedCatalogView |
resolveCatalogView(CatalogView view)
Resolves a
CatalogView to a validated ResolvedCatalogView . |
boolean |
schemaExists(String catalogName)
Checks if there is a catalog with given name or is there a temporary object registered within
a given catalog.
|
boolean |
schemaExists(String catalogName,
String databaseName)
Checks if there is a database with given name in a given catalog or is there a temporary
object registered within a given catalog and database.
|
void |
setCurrentCatalog(String catalogName)
Sets the current catalog name that will be used when resolving table path.
|
void |
setCurrentDatabase(String databaseName)
Sets the current database name that will be used when resolving a table path.
|
void |
unregisterCatalog(String catalogName,
boolean ignoreIfNotExists)
Unregisters a catalog under the given name.
|
public static CatalogManager.Builder newBuilder()
public void initSchemaResolver(boolean isStreamingMode, ExpressionResolver.ExpressionResolverBuilder expressionResolverBuilder)
SchemaResolver
for Schema
resolution.
Currently, the resolver cannot be passed in the constructor because of a chicken-and-egg
problem between Planner
and CatalogManager
.
public SchemaResolver getSchemaResolver()
public DataTypeFactory getDataTypeFactory()
public void registerCatalog(String catalogName, Catalog catalog)
catalogName
- name under which to register the given catalogcatalog
- catalog to registerCatalogException
- if the registration of the catalog under the given name failedpublic void unregisterCatalog(String catalogName, boolean ignoreIfNotExists)
catalogName
- name under which to unregister the given catalog.ignoreIfNotExists
- If false exception will be thrown if the table or database or
catalog to be altered does not exist.CatalogException
- if the unregistration of the catalog under the given name failedpublic Optional<Catalog> getCatalog(String catalogName)
catalogName
- name of the catalog to retrievepublic String getCurrentCatalog()
qualifyIdentifier(UnresolvedIdentifier)
public void setCurrentCatalog(String catalogName) throws CatalogNotExistException
catalogName
- catalog name to set as current catalogCatalogNotExistException
- thrown if the catalog doesn't existqualifyIdentifier(UnresolvedIdentifier)
public String getCurrentDatabase()
qualifyIdentifier(UnresolvedIdentifier)
public void setCurrentDatabase(String databaseName)
databaseName
- database name to set as current database nameCatalogException
- thrown if the database doesn't exist in the current catalogqualifyIdentifier(UnresolvedIdentifier)
,
setCurrentCatalog(String)
public String getBuiltInCatalogName()
public String getBuiltInDatabaseName()
public Optional<CatalogManager.TableLookupResult> getTable(ObjectIdentifier objectIdentifier)
qualifyIdentifier(UnresolvedIdentifier)
first.objectIdentifier
- full path of the table to retrievepublic Optional<CatalogPartition> getPartition(ObjectIdentifier tableIdentifier, CatalogPartitionSpec partitionSpec)
qualifyIdentifier(UnresolvedIdentifier)
first.tableIdentifier
- full path of the table to retrievepartitionSpec
- full partition specpublic Set<String> listCatalogs()
public Set<String> listTables()
public Set<String> listTables(String catalogName, String databaseName)
public Set<String> listTemporaryTables()
public Set<String> listTemporaryViews()
public Set<String> listViews()
public Set<String> listViews(String catalogName, String databaseName)
public Set<String> listSchemas()
NOTE:It is primarily used for interacting with Calcite's schema.
public Set<String> listSchemas(String catalogName)
NOTE:It is primarily used for interacting with Calcite's schema.
catalogName
- filter for the catalog part of the schemapublic boolean schemaExists(String catalogName)
NOTE:It is primarily used for interacting with Calcite's schema.
catalogName
- filter for the catalog part of the schemapublic boolean schemaExists(String catalogName, String databaseName)
NOTE:It is primarily used for interacting with Calcite's schema.
catalogName
- filter for the catalog part of the schemadatabaseName
- filter for the database part of the schemapublic ObjectIdentifier qualifyIdentifier(UnresolvedIdentifier identifier)
identifier's
length.identifier
- an unresolved identifierpublic void createTable(CatalogBaseTable table, ObjectIdentifier objectIdentifier, boolean ignoreIfExists)
table
- The table to put in the given path.objectIdentifier
- The fully qualified path where to put the table.ignoreIfExists
- If false exception will be thrown if a table exists in the given path.public void createTemporaryTable(CatalogBaseTable table, ObjectIdentifier objectIdentifier, boolean ignoreIfExists)
table
- The table to put in the given path.objectIdentifier
- The fully qualified path where to put the table.ignoreIfExists
- if false exception will be thrown if a table exists in the given path.public void dropTemporaryTable(ObjectIdentifier objectIdentifier, boolean ignoreIfNotExists)
objectIdentifier
- The fully qualified path of the table to drop.ignoreIfNotExists
- If false exception will be thrown if the table to be dropped does
not exist.public void dropTemporaryView(ObjectIdentifier objectIdentifier, boolean ignoreIfNotExists)
objectIdentifier
- The fully qualified path of the view to drop.ignoreIfNotExists
- If false exception will be thrown if the view to be dropped does not
exist.protected Optional<TemporaryOperationListener> getTemporaryOperationListener(ObjectIdentifier identifier)
public void alterTable(CatalogBaseTable table, ObjectIdentifier objectIdentifier, boolean ignoreIfNotExists)
table
- The table to put in the given pathobjectIdentifier
- The fully qualified path where to alter the table.ignoreIfNotExists
- If false exception will be thrown if the table or database or
catalog to be altered does not exist.public void dropTable(ObjectIdentifier objectIdentifier, boolean ignoreIfNotExists)
objectIdentifier
- The fully qualified path of the table to drop.ignoreIfNotExists
- If false exception will be thrown if the table to drop does not
exist.public void dropView(ObjectIdentifier objectIdentifier, boolean ignoreIfNotExists)
objectIdentifier
- The fully qualified path of the view to drop.ignoreIfNotExists
- If false exception will be thrown if the view to drop does not
exist.public ResolvedCatalogBaseTable<?> resolveCatalogBaseTable(CatalogBaseTable baseTable)
CatalogBaseTable
to a validated ResolvedCatalogBaseTable
.public ResolvedCatalogTable resolveCatalogTable(CatalogTable table)
CatalogTable
to a validated ResolvedCatalogTable
.public ResolvedCatalogView resolveCatalogView(CatalogView view)
CatalogView
to a validated ResolvedCatalogView
.Copyright © 2014–2023 The Apache Software Foundation. All rights reserved.