Package org.apache.iceberg.rest
Class RESTSessionCatalog
java.lang.Object
org.apache.iceberg.catalog.BaseSessionCatalog
org.apache.iceberg.catalog.BaseViewSessionCatalog
org.apache.iceberg.rest.RESTSessionCatalog
- All Implemented Interfaces:
- Closeable,- AutoCloseable,- SessionCatalog,- ViewSessionCatalog,- Configurable<Object>
public class RESTSessionCatalog
extends BaseViewSessionCatalog
implements Configurable<Object>, Closeable
- 
Nested Class SummaryNested classes/interfaces inherited from class org.apache.iceberg.catalog.BaseViewSessionCatalogBaseViewSessionCatalog.AsViewCatalogNested classes/interfaces inherited from class org.apache.iceberg.catalog.BaseSessionCatalogBaseSessionCatalog.AsCatalogNested classes/interfaces inherited from interface org.apache.iceberg.catalog.SessionCatalogSessionCatalog.SessionContext
- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionRESTSessionCatalog(Function<Map<String, String>, RESTClient> clientBuilder, BiFunction<SessionCatalog.SessionContext, Map<String, String>, FileIO> ioBuilder) 
- 
Method SummaryModifier and TypeMethodDescriptionbuildTable(SessionCatalog.SessionContext context, TableIdentifier identifier, Schema schema) Create a builder to create a table or start a create/replace transaction.buildView(SessionCatalog.SessionContext context, TableIdentifier identifier) Instantiate a builder to create or replace a SQL view.voidclose()voidcommitTransaction(SessionCatalog.SessionContext context, List<TableCommit> commits) voidcreateNamespace(SessionCatalog.SessionContext context, Namespace namespace, Map<String, String> metadata) Create a namespace in the catalog.booleandropNamespace(SessionCatalog.SessionContext context, Namespace ns) Drop a namespace.booleandropTable(SessionCatalog.SessionContext context, TableIdentifier identifier) Drop a table, without requesting that files are immediately deleted.booleandropView(SessionCatalog.SessionContext context, TableIdentifier identifier) Drop a view.voidinitialize(String name, Map<String, String> unresolved) Initialize given a custom name and a map of catalog properties.voidinvalidateTable(SessionCatalog.SessionContext context, TableIdentifier ident) Invalidate cached table metadata from current catalog.listNamespaces(SessionCatalog.SessionContext context, Namespace namespace) List child namespaces from the namespace.listTables(SessionCatalog.SessionContext context, Namespace ns) Return all the identifiers under this namespace.listViews(SessionCatalog.SessionContext context, Namespace namespace) Return all the identifiers under this namespace.loadNamespaceMetadata(SessionCatalog.SessionContext context, Namespace ns) Load metadata properties for a namespace.loadTable(SessionCatalog.SessionContext context, TableIdentifier identifier) Load a table.loadView(SessionCatalog.SessionContext context, TableIdentifier identifier) Load a view.booleannamespaceExists(SessionCatalog.SessionContext context, Namespace namespace) Checks whether the Namespace exists.booleanpurgeTable(SessionCatalog.SessionContext context, TableIdentifier identifier) Drop a table and request that files are immediately deleted.registerTable(SessionCatalog.SessionContext context, TableIdentifier ident, String metadataFileLocation) Register a table if it does not exist.voidrenameTable(SessionCatalog.SessionContext context, TableIdentifier from, TableIdentifier to) Rename a table.voidrenameView(SessionCatalog.SessionContext context, TableIdentifier from, TableIdentifier to) Rename a view.voidbooleantableExists(SessionCatalog.SessionContext context, TableIdentifier identifier) Check whether table exists.booleanupdateNamespaceMetadata(SessionCatalog.SessionContext context, Namespace ns, Map<String, String> updates, Set<String> removals) Set a collection of properties on a namespace in the catalog.booleanviewExists(SessionCatalog.SessionContext context, TableIdentifier identifier) Check whether view exists.Methods inherited from class org.apache.iceberg.catalog.BaseViewSessionCatalogasViewCatalogMethods inherited from class org.apache.iceberg.catalog.BaseSessionCatalogasCatalog, name, properties, withContextMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.iceberg.catalog.SessionCatalogcreateNamespace, listNamespacesMethods inherited from interface org.apache.iceberg.catalog.ViewSessionCataloginvalidateView, name
- 
Field Details- 
REST_PAGE_SIZE- See Also:
 
 
- 
- 
Constructor Details- 
RESTSessionCatalogpublic RESTSessionCatalog()
- 
RESTSessionCatalogpublic RESTSessionCatalog(Function<Map<String, String>, RESTClient> clientBuilder, BiFunction<SessionCatalog.SessionContext, Map<String, String>, FileIO> ioBuilder) 
 
- 
- 
Method Details- 
initializeDescription copied from interface:SessionCatalogInitialize given a custom name and a map of catalog properties.- Specified by:
- initializein interface- SessionCatalog
- Specified by:
- initializein interface- ViewSessionCatalog
- Overrides:
- initializein class- BaseSessionCatalog
- Parameters:
- name- a custom name for the catalog
- unresolved- catalog properties
 
- 
setConf- Specified by:
- setConfin interface- Configurable<Object>
 
- 
listTablesDescription copied from interface:SessionCatalogReturn all the identifiers under this namespace.- Specified by:
- listTablesin interface- SessionCatalog
- Parameters:
- context- session context
- ns- a namespace
- Returns:
- a list of identifiers for tables
 
- 
dropTableDescription copied from interface:SessionCatalogDrop a table, without requesting that files are immediately deleted.Data and metadata files should be deleted according to the catalog's policy. - Specified by:
- dropTablein interface- SessionCatalog
- Parameters:
- context- session context
- identifier- a table identifier
- Returns:
- true if the table was dropped, false if the table did not exist
 
- 
purgeTableDescription copied from interface:SessionCatalogDrop a table and request that files are immediately deleted.- Specified by:
- purgeTablein interface- SessionCatalog
- Parameters:
- context- session context
- identifier- a table identifier
- Returns:
- true if the table was dropped and purged, false if the table did not exist
 
- 
renameTablepublic void renameTable(SessionCatalog.SessionContext context, TableIdentifier from, TableIdentifier to) Description copied from interface:SessionCatalogRename a table.- Specified by:
- renameTablein interface- SessionCatalog
- Parameters:
- context- session context
- from- identifier of the table to rename
- to- new table name
 
- 
tableExistsDescription copied from interface:SessionCatalogCheck whether table exists.- Specified by:
- tableExistsin interface- SessionCatalog
- Parameters:
- context- session context
- identifier- a table identifier
- Returns:
- true if the table exists, false otherwise
 
- 
loadTableDescription copied from interface:SessionCatalogLoad a table.- Specified by:
- loadTablein interface- SessionCatalog
- Parameters:
- context- session context
- identifier- a table identifier
- Returns:
- instance of Tableimplementation referred bytableIdentifier
 
- 
buildTablepublic Catalog.TableBuilder buildTable(SessionCatalog.SessionContext context, TableIdentifier identifier, Schema schema) Description copied from interface:SessionCatalogCreate a builder to create a table or start a create/replace transaction.- Specified by:
- buildTablein interface- SessionCatalog
- Parameters:
- context- session context
- identifier- a table identifier
- schema- a schema
- Returns:
- the builder to create a table or start a create/replace transaction
 
- 
invalidateTableDescription copied from interface:SessionCatalogInvalidate cached table metadata from current catalog.If the table is already loaded or cached, drop cached data. If the table does not exist or is not cached, do nothing. - Specified by:
- invalidateTablein interface- SessionCatalog
- Parameters:
- context- session context
- ident- a table identifier
 
- 
registerTablepublic Table registerTable(SessionCatalog.SessionContext context, TableIdentifier ident, String metadataFileLocation) Description copied from interface:SessionCatalogRegister a table if it does not exist.- Specified by:
- registerTablein interface- SessionCatalog
- Parameters:
- context- session context
- ident- a table identifier
- metadataFileLocation- the location of a metadata file
- Returns:
- a Table instance
 
- 
createNamespacepublic void createNamespace(SessionCatalog.SessionContext context, Namespace namespace, Map<String, String> metadata) Description copied from interface:SessionCatalogCreate a namespace in the catalog.- Specified by:
- createNamespacein interface- SessionCatalog
- Parameters:
- context- session context
- namespace- a- namespace
- metadata- a string Map of properties for the given namespace
 
- 
listNamespacesDescription copied from interface:SessionCatalogList child namespaces from the namespace.For two existing tables named 'a.b.c.table' and 'a.b.d.table', this method returns: - Given: Namespace.empty()
- Returns: Namespace.of("a")
 - Given: Namespace.of("a")
- Returns: Namespace.of("a", "b")
 - Given: Namespace.of("a", "b")
- Returns: Namespace.of("a", "b", "c")andNamespace.of("a", "b", "d")
 - Given: Namespace.of("a", "b", "c")
- Returns: empty list, because there are no child namespaces
 - Specified by:
- listNamespacesin interface- SessionCatalog
- Parameters:
- context- session context
- namespace- a- namespace
- Returns:
- a List of child Namespacenames from the given namespace
 
- Given: 
- 
namespaceExistsDescription copied from interface:SessionCatalogChecks whether the Namespace exists.- Specified by:
- namespaceExistsin interface- SessionCatalog
- Parameters:
- context- session context
- namespace- a- namespace
- Returns:
- true if the Namespace exists, false otherwise
 
- 
loadNamespaceMetadatapublic Map<String,String> loadNamespaceMetadata(SessionCatalog.SessionContext context, Namespace ns) Description copied from interface:SessionCatalogLoad metadata properties for a namespace.- Specified by:
- loadNamespaceMetadatain interface- SessionCatalog
- Parameters:
- context- session context
- ns- a- namespace
- Returns:
- a string map of properties for the given namespace
 
- 
dropNamespaceDescription copied from interface:SessionCatalogDrop a namespace. If the namespace exists and was dropped, this will return true.- Specified by:
- dropNamespacein interface- SessionCatalog
- Parameters:
- context- session context
- ns- a- namespace
- Returns:
- true if the namespace was dropped, false otherwise.
 
- 
updateNamespaceMetadatapublic boolean updateNamespaceMetadata(SessionCatalog.SessionContext context, Namespace ns, Map<String, String> updates, Set<String> removals) Description copied from interface:SessionCatalogSet a collection of properties on a namespace in the catalog.Properties that are not in the given map are not modified or removed by this method. - Specified by:
- updateNamespaceMetadatain interface- SessionCatalog
- Parameters:
- context- session context
- ns- a- namespace
- updates- properties to set for the namespace
- removals- properties to remove from the namespace
 
- 
close- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Throws:
- IOException
 
- 
commitTransaction
- 
listViewsDescription copied from interface:ViewSessionCatalogReturn all the identifiers under this namespace.- Specified by:
- listViewsin interface- ViewSessionCatalog
- Parameters:
- namespace- a namespace
- Returns:
- a list of identifiers for views
 
- 
viewExistsDescription copied from interface:ViewSessionCatalogCheck whether view exists.- Specified by:
- viewExistsin interface- ViewSessionCatalog
- Parameters:
- identifier- a view identifier
- Returns:
- true if the view exists, false otherwise
 
- 
loadViewDescription copied from interface:ViewSessionCatalogLoad a view.- Specified by:
- loadViewin interface- ViewSessionCatalog
- Parameters:
- identifier- a view identifier
- Returns:
- instance of Viewimplementation referred by the identifier
 
- 
buildViewDescription copied from interface:ViewSessionCatalogInstantiate a builder to create or replace a SQL view.- Specified by:
- buildViewin interface- ViewSessionCatalog
- Parameters:
- identifier- a view identifier
- Returns:
- a view builder
 
- 
dropViewDescription copied from interface:ViewSessionCatalogDrop a view.- Specified by:
- dropViewin interface- ViewSessionCatalog
- Parameters:
- identifier- a view identifier
- Returns:
- true if the view was dropped, false if the view did not exist
 
- 
renameViewpublic void renameView(SessionCatalog.SessionContext context, TableIdentifier from, TableIdentifier to) Description copied from interface:ViewSessionCatalogRename a view.- Specified by:
- renameViewin interface- ViewSessionCatalog
- Parameters:
- from- identifier of the view to rename
- to- new view identifier
 
 
-