@Internal public class CatalogManager extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
CatalogManager.TableLookupResult
Result of a lookup for a table through
getTable(ObjectIdentifier). |
| Constructor and Description |
|---|
CatalogManager(String defaultCatalogName,
org.apache.flink.table.catalog.Catalog defaultCatalog) |
| Modifier and Type | Method and Description |
|---|---|
void |
alterTable(org.apache.flink.table.catalog.CatalogBaseTable table,
org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier,
boolean ignoreIfNotExists)
Alters a table in a given fully qualified path.
|
void |
createTable(org.apache.flink.table.catalog.CatalogBaseTable table,
org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier,
boolean ignoreIfExists)
Creates a table in a given fully qualified path.
|
void |
createTemporaryTable(org.apache.flink.table.catalog.CatalogBaseTable table,
org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier,
boolean replace)
Creates a temporary table in a given fully qualified path.
|
void |
dropTable(org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier,
boolean ignoreIfNotExists)
Drops a table in a given fully qualified path.
|
boolean |
dropTemporaryTable(org.apache.flink.table.catalog.UnresolvedIdentifier identifier)
Qualifies the given
UnresolvedIdentifier with current catalog & database and
removes a temporary table registered with this path if it exists. |
boolean |
dropTemporaryView(org.apache.flink.table.catalog.UnresolvedIdentifier identifier)
Qualifies the given
UnresolvedIdentifier with current catalog & database and
removes a temporary view registered with this path if it exists. |
String |
getBuiltInCatalogName()
Gets the built-in catalog name.
|
String |
getBuiltInDatabaseName()
Gets the built-in database name in the built-in catalog.
|
Optional<org.apache.flink.table.catalog.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.
|
Optional<CatalogManager.TableLookupResult> |
getTable(org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier)
Retrieves a fully qualified table.
|
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.
|
org.apache.flink.table.catalog.ObjectIdentifier |
qualifyIdentifier(org.apache.flink.table.catalog.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,
org.apache.flink.table.catalog.Catalog catalog)
Registers a catalog under the given name.
|
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.
|
public CatalogManager(String defaultCatalogName, org.apache.flink.table.catalog.Catalog defaultCatalog)
public void registerCatalog(String catalogName, org.apache.flink.table.catalog.Catalog catalog)
catalogName - name under which to register the given catalogcatalog - catalog to registerorg.apache.flink.table.catalog.exceptions.CatalogException - if the registration of the catalog under the given name failedpublic Optional<org.apache.flink.table.catalog.Catalog> getCatalog(String catalogName)
catalogName - name of the catalog to retrievepublic String getCurrentCatalog()
qualifyIdentifier(UnresolvedIdentifier)public void setCurrentCatalog(String catalogName) throws org.apache.flink.table.api.CatalogNotExistException
catalogName - catalog name to set as current catalogorg.apache.flink.table.api.CatalogNotExistException - 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 nameorg.apache.flink.table.catalog.exceptions.CatalogException - 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(org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier)
qualifyIdentifier(UnresolvedIdentifier) first.objectIdentifier - full path of the table to retrievepublic 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> listSchemas()
public Set<String> listSchemas(String catalogName)
catalogName - filter for the catalog part of the schemapublic boolean schemaExists(String catalogName)
catalogName - filter for the catalog part of the schemapublic boolean schemaExists(String catalogName, String databaseName)
catalogName - filter for the catalog part of the schemadatabaseName - filter for the database part of the schemapublic org.apache.flink.table.catalog.ObjectIdentifier qualifyIdentifier(org.apache.flink.table.catalog.UnresolvedIdentifier identifier)
identifier's length.identifier - an unresolved identifierpublic void createTable(org.apache.flink.table.catalog.CatalogBaseTable table,
org.apache.flink.table.catalog.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(org.apache.flink.table.catalog.CatalogBaseTable table,
org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier,
boolean replace)
table - The table to put in the given path.objectIdentifier - The fully qualified path where to put the table.replace - controls what happens if a table exists in the given path,
if true the table is replaced, an exception will be thrown otherwisepublic boolean dropTemporaryTable(org.apache.flink.table.catalog.UnresolvedIdentifier identifier)
UnresolvedIdentifier with current catalog & database and
removes a temporary table registered with this path if it exists.identifier - potentially unresolved identifierpublic boolean dropTemporaryView(org.apache.flink.table.catalog.UnresolvedIdentifier identifier)
UnresolvedIdentifier with current catalog & database and
removes a temporary view registered with this path if it exists.identifier - potentially unresolved identifierpublic void alterTable(org.apache.flink.table.catalog.CatalogBaseTable table,
org.apache.flink.table.catalog.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(org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier,
boolean ignoreIfNotExists)
objectIdentifier - The fully qualified path of the table to drop.ignoreIfNotExists - If false exception will be thrown if the table or database or catalog to be altered
does not exist.Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.