public class RESTSessionCatalog extends BaseViewSessionCatalog implements Configurable<java.lang.Object>, java.io.Closeable
BaseViewSessionCatalog.AsViewCatalog
BaseSessionCatalog.AsCatalog
SessionCatalog.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.
|
asViewCatalog
asCatalog, name, properties, withContext
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
invalidateView, name, viewExists
createNamespace, listNamespaces, namespaceExists, tableExists
public 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)
SessionCatalog
initialize
in interface SessionCatalog
initialize
in interface ViewSessionCatalog
initialize
in class BaseSessionCatalog
name
- 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)
SessionCatalog
listTables
in interface SessionCatalog
context
- session contextns
- a namespacepublic boolean dropTable(SessionCatalog.SessionContext context, TableIdentifier identifier)
SessionCatalog
Data and metadata files should be deleted according to the catalog's policy.
dropTable
in interface SessionCatalog
context
- session contextidentifier
- a table identifierpublic boolean purgeTable(SessionCatalog.SessionContext context, TableIdentifier identifier)
SessionCatalog
purgeTable
in interface SessionCatalog
context
- session contextidentifier
- a table identifierpublic void renameTable(SessionCatalog.SessionContext context, TableIdentifier from, TableIdentifier to)
SessionCatalog
renameTable
in interface SessionCatalog
context
- session contextfrom
- identifier of the table to renameto
- new table namepublic Table loadTable(SessionCatalog.SessionContext context, TableIdentifier identifier)
SessionCatalog
loadTable
in interface SessionCatalog
context
- session contextidentifier
- a table identifierTable
implementation referred by tableIdentifier
public Catalog.TableBuilder buildTable(SessionCatalog.SessionContext context, TableIdentifier identifier, Schema schema)
SessionCatalog
buildTable
in interface SessionCatalog
context
- session contextidentifier
- a table identifierschema
- a schemapublic void invalidateTable(SessionCatalog.SessionContext context, TableIdentifier ident)
SessionCatalog
If 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 SessionCatalog
context
- session contextident
- a table identifierpublic Table registerTable(SessionCatalog.SessionContext context, TableIdentifier ident, java.lang.String metadataFileLocation)
SessionCatalog
registerTable
in interface SessionCatalog
context
- 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)
SessionCatalog
createNamespace
in interface SessionCatalog
context
- session contextnamespace
- a namespace
metadata
- a string Map of properties for the given namespacepublic java.util.List<Namespace> listNamespaces(SessionCatalog.SessionContext context, Namespace namespace)
SessionCatalog
For 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 SessionCatalog
context
- session contextnamespace
- a namespace
Namespace
names from the given namespacepublic java.util.Map<java.lang.String,java.lang.String> loadNamespaceMetadata(SessionCatalog.SessionContext context, Namespace ns)
SessionCatalog
loadNamespaceMetadata
in interface SessionCatalog
context
- session contextns
- a namespace
public boolean dropNamespace(SessionCatalog.SessionContext context, Namespace ns)
SessionCatalog
dropNamespace
in interface SessionCatalog
context
- session contextns
- a namespace
public boolean updateNamespaceMetadata(SessionCatalog.SessionContext context, Namespace ns, java.util.Map<java.lang.String,java.lang.String> updates, java.util.Set<java.lang.String> removals)
SessionCatalog
Properties that are not in the given map are not modified or removed by this method.
updateNamespaceMetadata
in interface SessionCatalog
context
- session contextns
- a namespace
updates
- properties to set for the namespaceremovals
- properties to remove from the namespacepublic void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException
public void commitTransaction(SessionCatalog.SessionContext context, java.util.List<TableCommit> commits)
public java.util.List<TableIdentifier> listViews(SessionCatalog.SessionContext context, Namespace namespace)
ViewSessionCatalog
listViews
in interface ViewSessionCatalog
namespace
- a namespacepublic View loadView(SessionCatalog.SessionContext context, TableIdentifier identifier)
ViewSessionCatalog
loadView
in interface ViewSessionCatalog
identifier
- a view identifierView
implementation referred by the identifierpublic org.apache.iceberg.rest.RESTSessionCatalog.RESTViewBuilder buildView(SessionCatalog.SessionContext context, TableIdentifier identifier)
ViewSessionCatalog
buildView
in interface ViewSessionCatalog
identifier
- a view identifierpublic boolean dropView(SessionCatalog.SessionContext context, TableIdentifier identifier)
ViewSessionCatalog
dropView
in interface ViewSessionCatalog
identifier
- a view identifierpublic void renameView(SessionCatalog.SessionContext context, TableIdentifier from, TableIdentifier to)
ViewSessionCatalog
renameView
in interface ViewSessionCatalog
from
- identifier of the view to renameto
- new view identifier