@Evolving public interface SupportsNamespaces extends CatalogPlugin
If an object such as a table, view, or function exists, its parent namespaces must also exist
and must be returned by the discovery methods listNamespaces()
and
listNamespaces(String[])
.
Catalog implementations are not required to maintain the existence of namespaces independent of
objects in a namespace. For example, a function catalog that loads functions using reflection
and uses Java packages as namespaces is not required to support the methods to create, alter, or
drop a namespace. Implementations are allowed to discover the existence of objects or namespaces
without throwing NoSuchNamespaceException
when no namespace is found.
Modifier and Type | Field and Description |
---|---|
static String |
PROP_COMMENT
A reserved property to specify the description of the namespace.
|
static String |
PROP_LOCATION
A reserved property to specify the location of the namespace.
|
static String |
PROP_OWNER
A reserved property to specify the owner of the namespace.
|
Modifier and Type | Method and Description |
---|---|
void |
alterNamespace(String[] namespace,
NamespaceChange... changes)
Apply a set of metadata changes to a namespace in the catalog.
|
void |
createNamespace(String[] namespace,
java.util.Map<String,String> metadata)
Create a namespace in the catalog.
|
boolean |
dropNamespace(String[] namespace,
boolean cascade)
Drop a namespace from the catalog with cascade mode, recursively dropping all objects
within the namespace if cascade is true.
|
String[][] |
listNamespaces()
List top-level namespaces from the catalog.
|
String[][] |
listNamespaces(String[] namespace)
List namespaces in a namespace.
|
java.util.Map<String,String> |
loadNamespaceMetadata(String[] namespace)
Load metadata properties for a namespace.
|
default boolean |
namespaceExists(String[] namespace)
Test whether a namespace exists.
|
defaultNamespace, initialize, name
static final String PROP_LOCATION
static final String PROP_COMMENT
static final String PROP_OWNER
String[][] listNamespaces() throws org.apache.spark.sql.catalyst.analysis.NoSuchNamespaceException
If an object such as a table, view, or function exists, its parent namespaces must also exist and must be returned by this discovery method. For example, if table a.b.t exists, this method must return ["a"] in the result array.
org.apache.spark.sql.catalyst.analysis.NoSuchNamespaceException
String[][] listNamespaces(String[] namespace) throws org.apache.spark.sql.catalyst.analysis.NoSuchNamespaceException
If an object such as a table, view, or function exists, its parent namespaces must also exist and must be returned by this discovery method. For example, if table a.b.t exists, this method invoked as listNamespaces(["a"]) must return ["a", "b"] in the result array.
namespace
- a multi-part namespaceorg.apache.spark.sql.catalyst.analysis.NoSuchNamespaceException
- If the namespace does not exist (optional)default boolean namespaceExists(String[] namespace)
If an object such as a table, view, or function exists, its parent namespaces must also exist. For example, if table a.b.t exists, this method invoked as namespaceExists(["a"]) or namespaceExists(["a", "b"]) must return true.
namespace
- a multi-part namespacejava.util.Map<String,String> loadNamespaceMetadata(String[] namespace) throws org.apache.spark.sql.catalyst.analysis.NoSuchNamespaceException
namespace
- a multi-part namespaceorg.apache.spark.sql.catalyst.analysis.NoSuchNamespaceException
- If the namespace does not exist (optional)UnsupportedOperationException
- If namespace properties are not supportedvoid createNamespace(String[] namespace, java.util.Map<String,String> metadata) throws org.apache.spark.sql.catalyst.analysis.NamespaceAlreadyExistsException
namespace
- a multi-part namespacemetadata
- a string map of properties for the given namespaceorg.apache.spark.sql.catalyst.analysis.NamespaceAlreadyExistsException
- If the namespace already existsUnsupportedOperationException
- If create is not a supported operationvoid alterNamespace(String[] namespace, NamespaceChange... changes) throws org.apache.spark.sql.catalyst.analysis.NoSuchNamespaceException
namespace
- a multi-part namespacechanges
- a collection of changes to apply to the namespaceorg.apache.spark.sql.catalyst.analysis.NoSuchNamespaceException
- If the namespace does not exist (optional)UnsupportedOperationException
- If namespace properties are not supportedboolean dropNamespace(String[] namespace, boolean cascade) throws org.apache.spark.sql.catalyst.analysis.NoSuchNamespaceException, org.apache.spark.sql.catalyst.analysis.NonEmptyNamespaceException
If the catalog implementation does not support this operation, it may throw
UnsupportedOperationException
.
namespace
- a multi-part namespacecascade
- When true, deletes all objects under the namespaceorg.apache.spark.sql.catalyst.analysis.NoSuchNamespaceException
- If the namespace does not exist (optional)org.apache.spark.sql.catalyst.analysis.NonEmptyNamespaceException
- If the namespace is non-empty and cascade is falseUnsupportedOperationException
- If drop is not a supported operation