public interface SessionCatalog
Modifier and Type | Interface and Description |
---|---|
static class |
SessionCatalog.SessionContext
Context for a session.
|
Modifier and Type | Method and Description |
---|---|
Catalog.TableBuilder |
buildTable(SessionCatalog.SessionContext context,
TableIdentifier ident,
Schema schema)
Create a builder to create a table or start a create/replace transaction.
|
default void |
createNamespace(SessionCatalog.SessionContext context,
Namespace namespace)
Create a namespace in the catalog.
|
void |
createNamespace(SessionCatalog.SessionContext context,
Namespace namespace,
java.util.Map<java.lang.String,java.lang.String> metadata)
Create a namespace in the catalog.
|
boolean |
dropNamespace(SessionCatalog.SessionContext context,
Namespace namespace)
Drop a namespace.
|
boolean |
dropTable(SessionCatalog.SessionContext context,
TableIdentifier ident)
Drop a table, without requesting that files are immediately deleted.
|
void |
initialize(java.lang.String name,
java.util.Map<java.lang.String,java.lang.String> properties)
Initialize given a custom name and a map of catalog properties.
|
void |
invalidateTable(SessionCatalog.SessionContext context,
TableIdentifier ident)
Invalidate cached table metadata from current catalog.
|
default java.util.List<Namespace> |
listNamespaces(SessionCatalog.SessionContext context)
List top-level namespaces from the catalog.
|
java.util.List<Namespace> |
listNamespaces(SessionCatalog.SessionContext context,
Namespace namespace)
List namespaces from the namespace.
|
java.util.List<TableIdentifier> |
listTables(SessionCatalog.SessionContext context,
Namespace namespace)
Return all the identifiers under this namespace.
|
java.util.Map<java.lang.String,java.lang.String> |
loadNamespaceMetadata(SessionCatalog.SessionContext context,
Namespace namespace)
Load metadata properties for a namespace.
|
Table |
loadTable(SessionCatalog.SessionContext context,
TableIdentifier ident)
Load a table.
|
java.lang.String |
name()
Return the name for this catalog.
|
default boolean |
namespaceExists(SessionCatalog.SessionContext context,
Namespace namespace)
Checks whether the Namespace exists.
|
java.util.Map<java.lang.String,java.lang.String> |
properties()
Return the properties for this catalog.
|
boolean |
purgeTable(SessionCatalog.SessionContext context,
TableIdentifier ident)
Drop a table and request that files are immediately deleted.
|
Table |
registerTable(SessionCatalog.SessionContext context,
TableIdentifier ident,
java.lang.String metadataFileLocation)
Register a table if it does not exist.
|
void |
renameTable(SessionCatalog.SessionContext context,
TableIdentifier from,
TableIdentifier to)
Rename a table.
|
default boolean |
tableExists(SessionCatalog.SessionContext context,
TableIdentifier ident)
Check whether table exists.
|
boolean |
updateNamespaceMetadata(SessionCatalog.SessionContext context,
Namespace namespace,
java.util.Map<java.lang.String,java.lang.String> updates,
java.util.Set<java.lang.String> removals)
Set a collection of properties on a namespace in the catalog.
|
void initialize(java.lang.String name, java.util.Map<java.lang.String,java.lang.String> properties)
name
- a custom name for the catalogproperties
- catalog propertiesjava.lang.String name()
java.util.Map<java.lang.String,java.lang.String> properties()
java.util.List<TableIdentifier> listTables(SessionCatalog.SessionContext context, Namespace namespace)
context
- session contextnamespace
- a namespaceNoSuchNamespaceException
- if the namespace does not existCatalog.TableBuilder buildTable(SessionCatalog.SessionContext context, TableIdentifier ident, Schema schema)
context
- session contextident
- a table identifierschema
- a schemaTable registerTable(SessionCatalog.SessionContext context, TableIdentifier ident, java.lang.String metadataFileLocation)
context
- session contextident
- a table identifiermetadataFileLocation
- the location of a metadata fileAlreadyExistsException
- if the table already exists in the catalog.default boolean tableExists(SessionCatalog.SessionContext context, TableIdentifier ident)
context
- session contextident
- a table identifierTable loadTable(SessionCatalog.SessionContext context, TableIdentifier ident)
context
- session contextident
- a table identifierTable
implementation referred by tableIdentifier
NoSuchTableException
- if the table does not existboolean dropTable(SessionCatalog.SessionContext context, TableIdentifier ident)
Data and metadata files should be deleted according to the catalog's policy.
context
- session contextident
- a table identifierboolean purgeTable(SessionCatalog.SessionContext context, TableIdentifier ident)
context
- session contextident
- a table identifierjava.lang.UnsupportedOperationException
- if immediate delete is not supportedvoid renameTable(SessionCatalog.SessionContext context, TableIdentifier from, TableIdentifier to)
context
- session contextfrom
- identifier of the table to renameto
- new table nameNoSuchTableException
- if the from table does not existAlreadyExistsException
- if the to table already existsvoid invalidateTable(SessionCatalog.SessionContext context, TableIdentifier ident)
If the table is already loaded or cached, drop cached data. If the table does not exist or is not cached, do nothing.
context
- session contextident
- a table identifierdefault void createNamespace(SessionCatalog.SessionContext context, Namespace namespace)
context
- session contextnamespace
- a namespace
AlreadyExistsException
- If the namespace already existsjava.lang.UnsupportedOperationException
- If create is not a supported operationvoid createNamespace(SessionCatalog.SessionContext context, Namespace namespace, java.util.Map<java.lang.String,java.lang.String> metadata)
context
- session contextnamespace
- a namespace
metadata
- a string Map of properties for the given namespaceAlreadyExistsException
- If the namespace already existsjava.lang.UnsupportedOperationException
- If create is not a supported operationdefault java.util.List<Namespace> listNamespaces(SessionCatalog.SessionContext context)
If an object such as a table, view, or function exists, its parent namespaces must also exist and must be returned by this discovery method. For example, if table a.b.t exists, this method must return ["a"] in the result array.
context
- session contextNamespace
namesjava.util.List<Namespace> listNamespaces(SessionCatalog.SessionContext context, Namespace namespace)
For example, if table a.b.t exists, use 'SELECT NAMESPACE IN a' this method must return
Namepace.of("a","b") Namespace
.
context
- session contextnamespace
- a namespace
Namespace
namesNoSuchNamespaceException
- If the namespace does not exist (optional)java.util.Map<java.lang.String,java.lang.String> loadNamespaceMetadata(SessionCatalog.SessionContext context, Namespace namespace)
context
- session contextnamespace
- a namespace
NoSuchNamespaceException
- If the namespace does not exist (optional)boolean dropNamespace(SessionCatalog.SessionContext context, Namespace namespace)
context
- session contextnamespace
- a namespace
NamespaceNotEmptyException
- If the namespace is not emptyboolean updateNamespaceMetadata(SessionCatalog.SessionContext context, Namespace namespace, java.util.Map<java.lang.String,java.lang.String> updates, java.util.Set<java.lang.String> removals)
Properties that are not in the given map are not modified or removed by this method.
context
- session contextnamespace
- a namespace
updates
- properties to set for the namespaceremovals
- properties to remove from the namespaceNoSuchNamespaceException
- If the namespace does not exist (optional)java.lang.UnsupportedOperationException
- If namespace properties are not supporteddefault boolean namespaceExists(SessionCatalog.SessionContext context, Namespace namespace)
context
- session contextnamespace
- a namespace