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,
Catalog defaultCatalog) |
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 replace)
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.
|
boolean |
dropTemporaryTable(UnresolvedIdentifier identifier)
Qualifies the given
UnresolvedIdentifier with current catalog & database and
removes a temporary table registered with this path if it exists. |
boolean |
dropTemporaryView(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<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(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.
|
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.
|
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 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 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 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 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 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(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(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(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 or database or catalog to be altered
does not exist.Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.