public class RESTSessionCatalog extends BaseViewSessionCatalog implements Configurable<java.lang.Object>, java.io.Closeable
BaseViewSessionCatalog.AsViewCatalogBaseSessionCatalog.AsCatalogSessionCatalog.SessionContext| Constructor and Description |
|---|
RESTSessionCatalog() |
RESTSessionCatalog(java.util.function.Function<java.util.Map<java.lang.String,java.lang.String>,RESTClient> clientBuilder,
java.util.function.BiFunction<SessionCatalog.SessionContext,java.util.Map<java.lang.String,java.lang.String>,FileIO> ioBuilder) |
| Modifier and Type | Method and Description |
|---|---|
Catalog.TableBuilder |
buildTable(SessionCatalog.SessionContext context,
TableIdentifier identifier,
Schema schema)
Create a builder to create a table or start a create/replace transaction.
|
org.apache.iceberg.rest.RESTSessionCatalog.RESTViewBuilder |
buildView(SessionCatalog.SessionContext context,
TableIdentifier identifier)
Instantiate a builder to create or replace a SQL view.
|
void |
close() |
void |
commitTransaction(SessionCatalog.SessionContext context,
java.util.List<TableCommit> commits) |
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 ns)
Drop a namespace.
|
boolean |
dropTable(SessionCatalog.SessionContext context,
TableIdentifier identifier)
Drop a table, without requesting that files are immediately deleted.
|
boolean |
dropView(SessionCatalog.SessionContext context,
TableIdentifier identifier)
Drop a view.
|
void |
initialize(java.lang.String name,
java.util.Map<java.lang.String,java.lang.String> unresolved)
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.
|
java.util.List<Namespace> |
listNamespaces(SessionCatalog.SessionContext context,
Namespace namespace)
List child namespaces from the namespace.
|
java.util.List<TableIdentifier> |
listTables(SessionCatalog.SessionContext context,
Namespace ns)
Return all the identifiers under this namespace.
|
java.util.List<TableIdentifier> |
listViews(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 ns)
Load metadata properties for a namespace.
|
Table |
loadTable(SessionCatalog.SessionContext context,
TableIdentifier identifier)
Load a table.
|
View |
loadView(SessionCatalog.SessionContext context,
TableIdentifier identifier)
Load a view.
|
boolean |
purgeTable(SessionCatalog.SessionContext context,
TableIdentifier identifier)
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.
|
void |
renameView(SessionCatalog.SessionContext context,
TableIdentifier from,
TableIdentifier to)
Rename a view.
|
void |
setConf(java.lang.Object newConf) |
boolean |
updateNamespaceMetadata(SessionCatalog.SessionContext context,
Namespace ns,
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.
|
asViewCatalogasCatalog, name, properties, withContextclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitinvalidateView, name, viewExistscreateNamespace, listNamespaces, namespaceExists, tableExistspublic RESTSessionCatalog()
public RESTSessionCatalog(java.util.function.Function<java.util.Map<java.lang.String,java.lang.String>,RESTClient> clientBuilder, java.util.function.BiFunction<SessionCatalog.SessionContext,java.util.Map<java.lang.String,java.lang.String>,FileIO> ioBuilder)
public void initialize(java.lang.String name,
java.util.Map<java.lang.String,java.lang.String> unresolved)
SessionCataloginitialize in interface SessionCataloginitialize in interface ViewSessionCataloginitialize in class BaseSessionCatalogname - a custom name for the catalogunresolved - catalog propertiespublic void setConf(java.lang.Object newConf)
setConf in interface Configurable<java.lang.Object>public java.util.List<TableIdentifier> listTables(SessionCatalog.SessionContext context, Namespace ns)
SessionCataloglistTables in interface SessionCatalogcontext - session contextns - a namespacepublic boolean dropTable(SessionCatalog.SessionContext context, TableIdentifier identifier)
SessionCatalogData and metadata files should be deleted according to the catalog's policy.
dropTable in interface SessionCatalogcontext - session contextidentifier - a table identifierpublic boolean purgeTable(SessionCatalog.SessionContext context, TableIdentifier identifier)
SessionCatalogpurgeTable in interface SessionCatalogcontext - session contextidentifier - a table identifierpublic void renameTable(SessionCatalog.SessionContext context, TableIdentifier from, TableIdentifier to)
SessionCatalogrenameTable in interface SessionCatalogcontext - session contextfrom - identifier of the table to renameto - new table namepublic Table loadTable(SessionCatalog.SessionContext context, TableIdentifier identifier)
SessionCatalogloadTable in interface SessionCatalogcontext - session contextidentifier - a table identifierTable implementation referred by tableIdentifierpublic Catalog.TableBuilder buildTable(SessionCatalog.SessionContext context, TableIdentifier identifier, Schema schema)
SessionCatalogbuildTable in interface SessionCatalogcontext - session contextidentifier - a table identifierschema - a schemapublic void invalidateTable(SessionCatalog.SessionContext context, TableIdentifier ident)
SessionCatalogIf the table is already loaded or cached, drop cached data. If the table does not exist or is not cached, do nothing.
invalidateTable in interface SessionCatalogcontext - session contextident - a table identifierpublic Table registerTable(SessionCatalog.SessionContext context, TableIdentifier ident, java.lang.String metadataFileLocation)
SessionCatalogregisterTable in interface SessionCatalogcontext - session contextident - a table identifiermetadataFileLocation - the location of a metadata filepublic void createNamespace(SessionCatalog.SessionContext context, Namespace namespace, java.util.Map<java.lang.String,java.lang.String> metadata)
SessionCatalogcreateNamespace in interface SessionCatalogcontext - session contextnamespace - a namespacemetadata - a string Map of properties for the given namespacepublic java.util.List<Namespace> listNamespaces(SessionCatalog.SessionContext context, Namespace namespace)
SessionCatalogFor two existing tables named 'a.b.c.table' and 'a.b.d.table', this method returns:
Namespace.empty()
Namespace.of("a")
Namespace.of("a")
Namespace.of("a", "b")
Namespace.of("a", "b")
Namespace.of("a", "b", "c") and Namespace.of("a", "b", "d")
Namespace.of("a", "b", "c")
listNamespaces in interface SessionCatalogcontext - session contextnamespace - a namespaceNamespace names from the given namespacepublic java.util.Map<java.lang.String,java.lang.String> loadNamespaceMetadata(SessionCatalog.SessionContext context, Namespace ns)
SessionCatalogloadNamespaceMetadata in interface SessionCatalogcontext - session contextns - a namespacepublic boolean dropNamespace(SessionCatalog.SessionContext context, Namespace ns)
SessionCatalogdropNamespace in interface SessionCatalogcontext - session contextns - a namespacepublic boolean updateNamespaceMetadata(SessionCatalog.SessionContext context, Namespace ns, java.util.Map<java.lang.String,java.lang.String> updates, java.util.Set<java.lang.String> removals)
SessionCatalogProperties that are not in the given map are not modified or removed by this method.
updateNamespaceMetadata in interface SessionCatalogcontext - session contextns - a namespaceupdates - properties to set for the namespaceremovals - properties to remove from the namespacepublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOExceptionpublic void commitTransaction(SessionCatalog.SessionContext context, java.util.List<TableCommit> commits)
public java.util.List<TableIdentifier> listViews(SessionCatalog.SessionContext context, Namespace namespace)
ViewSessionCataloglistViews in interface ViewSessionCatalognamespace - a namespacepublic View loadView(SessionCatalog.SessionContext context, TableIdentifier identifier)
ViewSessionCatalogloadView in interface ViewSessionCatalogidentifier - a view identifierView implementation referred by the identifierpublic org.apache.iceberg.rest.RESTSessionCatalog.RESTViewBuilder buildView(SessionCatalog.SessionContext context, TableIdentifier identifier)
ViewSessionCatalogbuildView in interface ViewSessionCatalogidentifier - a view identifierpublic boolean dropView(SessionCatalog.SessionContext context, TableIdentifier identifier)
ViewSessionCatalogdropView in interface ViewSessionCatalogidentifier - a view identifierpublic void renameView(SessionCatalog.SessionContext context, TableIdentifier from, TableIdentifier to)
ViewSessionCatalogrenameView in interface ViewSessionCatalogfrom - identifier of the view to renameto - new view identifier