@Internal public class CatalogManager extends Object
Catalog
as well as ExternalCatalog
).Modifier and Type | Class and Description |
---|---|
static class |
CatalogManager.ResolvedTable
Temporary solution to handle both
CatalogBaseTable and
ExternalCatalogTable in a single call. |
Constructor and Description |
---|
CatalogManager(String defaultCatalogName,
Catalog defaultCatalog) |
Modifier and Type | Method and Description |
---|---|
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.
|
Set<String> |
getCatalogs()
Retrieves names of all registered catalogs.
|
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<ExternalCatalog> |
getExternalCatalog(String externalCatalogName)
Deprecated.
ExternalCatalog APIs will be dropped |
Set<String> |
getExternalCatalogs()
Deprecated.
ExternalCatalog APIs will be dropped |
String[] |
getFullTablePath(List<String> paths)
Returns the full name of the given table path, this name may be padded
with current catalog/database name based on the
paths length. |
void |
registerCatalog(String catalogName,
Catalog catalog)
Registers a catalog under the given name.
|
void |
registerExternalCatalog(String catalogName,
ExternalCatalog catalog)
Deprecated.
ExternalCatalog APIs will be dropped |
Optional<CatalogManager.ResolvedTable> |
resolveTable(String... tablePath)
Tries to resolve a table path to a
CatalogManager.ResolvedTable . |
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 void registerCatalog(String catalogName, Catalog catalog)
Catalog
s and ExternalCatalog
s.catalogName
- name under which to register the given catalogcatalog
- catalog to registerCatalogException
- if the registration of the catalog under the given name failedpublic Optional<Catalog> getCatalog(String catalogName)
catalogName
- name of the catalog to retrievegetExternalCatalog(String)
@Deprecated public void registerExternalCatalog(String catalogName, ExternalCatalog catalog)
ExternalCatalog
APIs will be droppedCatalog
s and ExternalCatalog
s.catalogName
- name under which to register the given catalogcatalog
- catalog to registerCatalogException
- thrown if the name is already taken@Deprecated public Optional<ExternalCatalog> getExternalCatalog(String externalCatalogName)
ExternalCatalog
APIs will be droppedexternalCatalogName
- name of the catalog to retrievegetCatalog(String)
public Set<String> getCatalogs()
ExternalCatalog
s.getExternalCatalogs()
@Deprecated public Set<String> getExternalCatalogs()
ExternalCatalog
APIs will be droppedCatalog
s.getCatalogs()
public String getCurrentCatalog()
resolveTable(String...)
public void setCurrentCatalog(String catalogName) throws CatalogNotExistException
catalogName
- catalog name to set as current catalogCatalogNotExistException
- thrown if the catalog doesn't existresolveTable(String...)
public String getCurrentDatabase()
resolveTable(String...)
public void setCurrentDatabase(String databaseName)
databaseName
- database name to set as current database nameCatalogException
- thrown if the database doesn't exist in the current catalogresolveTable(String...)
,
setCurrentCatalog(String)
public String getBuiltInCatalogName()
public String getBuiltInDatabaseName()
public Optional<CatalogManager.ResolvedTable> resolveTable(String... tablePath)
CatalogManager.ResolvedTable
. The algorithm looks for requested table
in the following paths in that order:
[current-catalog].[current-database].[tablePath]
[current-catalog].[tablePath]
[tablePath]
tablePath
- table path to look forCatalogManager.ResolvedTable
wrapping original table with additional information about table path and
unified access to TableSchema
.public String[] getFullTablePath(List<String> paths)
paths
length.paths
- Table paths whose format can be "catalog.db.table", "db.table" or "table"Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.