public class RESTSessionCatalog extends BaseSessionCatalog implements Configurable<java.lang.Object>, java.io.Closeable
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.
|
void |
close() |
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.
|
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 namespaces from the namespace.
|
java.util.List<TableIdentifier> |
listTables(SessionCatalog.SessionContext context,
Namespace ns)
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.
|
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 |
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.
|
asCatalog, name, properties, withContext
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
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 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 example, if table a.b.t exists, use 'SELECT NAMESPACE IN a' this method must return
Namepace.of("a","b") Namespace
.
listNamespaces
in interface SessionCatalog
context
- session contextnamespace
- a namespace
Namespace
namespublic 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