@Experimental 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 property to specify the description of the namespace.
|
static String |
PROP_LOCATION
A property to specify the location of the namespace.
|
static String |
PROP_OWNER_NAME
A property to specify the owner of the namespace.
|
static String |
PROP_OWNER_TYPE
A property to specify the type of the namespace's owner.
|
static java.util.List<String> |
RESERVED_PROPERTIES
The list of reserved namespace properties.
|
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.
|
default String[] |
defaultNamespace()
Return a default namespace for the catalog.
|
boolean |
dropNamespace(String[] namespace)
Drop a namespace from the catalog, recursively dropping all objects within the namespace.
|
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.
|
initialize, name
static final String PROP_LOCATION
static final String PROP_COMMENT
static final String PROP_OWNER_NAME
static final String PROP_OWNER_TYPE
static final java.util.List<String> RESERVED_PROPERTIES
default String[] defaultNamespace()
When this catalog is set as the current catalog, the namespace returned by this method will be set as the current namespace.
The namespace returned by this method is not required to exist.
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) throws org.apache.spark.sql.catalyst.analysis.NoSuchNamespaceException
If the catalog implementation does not support this operation, it may throw
UnsupportedOperationException
.
namespace
- a multi-part namespaceorg.apache.spark.sql.catalyst.analysis.NoSuchNamespaceException
- If the namespace does not exist (optional)UnsupportedOperationException
- If drop is not a supported operation