Package org.apache.iceberg.catalog
Interface ViewSessionCatalog
-
- All Known Implementing Classes:
BaseViewSessionCatalog
,RESTSessionCatalog
public interface ViewSessionCatalog
A session Catalog API for view create, drop, and load operations.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description ViewBuilder
buildView(SessionCatalog.SessionContext context, TableIdentifier identifier)
Instantiate a builder to create or replace a SQL view.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> properties)
Initialize a view catalog given a custom name and a map of catalog properties.default void
invalidateView(SessionCatalog.SessionContext context, TableIdentifier identifier)
Invalidate cached view metadata from current catalog.java.util.List<TableIdentifier>
listViews(SessionCatalog.SessionContext context, Namespace namespace)
Return all the identifiers under this namespace.View
loadView(SessionCatalog.SessionContext context, TableIdentifier identifier)
Load a view.java.lang.String
name()
Return the name for this catalog.void
renameView(SessionCatalog.SessionContext context, TableIdentifier from, TableIdentifier to)
Rename a view.default boolean
viewExists(SessionCatalog.SessionContext context, TableIdentifier identifier)
Check whether view exists.
-
-
-
Method Detail
-
name
java.lang.String name()
Return the name for this catalog.- Returns:
- this catalog's name
-
listViews
java.util.List<TableIdentifier> listViews(SessionCatalog.SessionContext context, Namespace namespace)
Return all the identifiers under this namespace.- Parameters:
namespace
- a namespace- Returns:
- a list of identifiers for views
- Throws:
NoSuchNamespaceException
- if the namespace is not found
-
loadView
View loadView(SessionCatalog.SessionContext context, TableIdentifier identifier)
Load a view.- Parameters:
identifier
- a view identifier- Returns:
- instance of
View
implementation referred by the identifier - Throws:
NoSuchViewException
- if the view does not exist
-
viewExists
default boolean viewExists(SessionCatalog.SessionContext context, TableIdentifier identifier)
Check whether view exists.- Parameters:
identifier
- a view identifier- Returns:
- true if the view exists, false otherwise
-
buildView
ViewBuilder buildView(SessionCatalog.SessionContext context, TableIdentifier identifier)
Instantiate a builder to create or replace a SQL view.- Parameters:
identifier
- a view identifier- Returns:
- a view builder
-
dropView
boolean dropView(SessionCatalog.SessionContext context, TableIdentifier identifier)
Drop a view.- Parameters:
identifier
- a view identifier- Returns:
- true if the view was dropped, false if the view did not exist
-
renameView
void renameView(SessionCatalog.SessionContext context, TableIdentifier from, TableIdentifier to)
Rename a view.- Parameters:
from
- identifier of the view to renameto
- new view identifier- Throws:
NoSuchViewException
- if the "from" view does not existAlreadyExistsException
- if the "to" view already existsNoSuchNamespaceException
- if the "to" namespace doesn't exist
-
invalidateView
default void invalidateView(SessionCatalog.SessionContext context, TableIdentifier identifier)
Invalidate cached view metadata from current catalog.If the view is already loaded or cached, drop cached data. If the view does not exist or is not cached, do nothing.
- Parameters:
identifier
- a view identifier
-
initialize
void initialize(java.lang.String name, java.util.Map<java.lang.String,java.lang.String> properties)
Initialize a view catalog given a custom name and a map of catalog properties.A custom view catalog implementation must have a no-arg constructor. A compute engine like Spark or Flink will first initialize the catalog without any arguments, and then call this method to complete catalog initialization with properties passed into the engine.
- Parameters:
name
- a custom name for the catalogproperties
- catalog properties
-
-