public interface SupportsNamespaces
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(Namespace namespace)
.
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 | Method and Description |
---|---|
default void |
createNamespace(Namespace namespace)
Create a namespace in the catalog.
|
void |
createNamespace(Namespace namespace,
java.util.Map<java.lang.String,java.lang.String> metadata)
Create a namespace in the catalog.
|
boolean |
dropNamespace(Namespace namespace)
Drop a namespace.
|
default java.util.List<Namespace> |
listNamespaces()
List top-level namespaces from the catalog.
|
java.util.List<Namespace> |
listNamespaces(Namespace namespace)
List namespaces from the namespace.
|
java.util.Map<java.lang.String,java.lang.String> |
loadNamespaceMetadata(Namespace namespace)
Load metadata properties for a namespace.
|
default boolean |
namespaceExists(Namespace namespace)
Checks whether the Namespace exists.
|
boolean |
removeProperties(Namespace namespace,
java.util.Set<java.lang.String> properties)
Remove a set of property keys from a namespace in the catalog.
|
boolean |
setProperties(Namespace namespace,
java.util.Map<java.lang.String,java.lang.String> properties)
Set a collection of properties on a namespace in the catalog.
|
default void createNamespace(Namespace namespace)
namespace
- a namespace. Namespace
.AlreadyExistsException
- If the namespace already existsjava.lang.UnsupportedOperationException
- If create is not a supported operationvoid createNamespace(Namespace namespace, java.util.Map<java.lang.String,java.lang.String> metadata)
namespace
- a multi-part namespacemetadata
- a string Map of properties for the given namespaceAlreadyExistsException
- If the namespace already existsjava.lang.UnsupportedOperationException
- If create is not a supported operationdefault java.util.List<Namespace> listNamespaces()
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.
Namespace
namesjava.util.List<Namespace> listNamespaces(Namespace namespace) throws NoSuchNamespaceException
For example, if table a.b.t exists, use 'SELECT NAMESPACE IN a' this method must return
Namepace.of("a","b") Namespace
.
Namespace
namesNoSuchNamespaceException
- If the namespace does not exist (optional)java.util.Map<java.lang.String,java.lang.String> loadNamespaceMetadata(Namespace namespace) throws NoSuchNamespaceException
namespace
- a namespace. Namespace
NoSuchNamespaceException
- If the namespace does not exist (optional)boolean dropNamespace(Namespace namespace) throws NamespaceNotEmptyException
namespace
- a namespace. Namespace
NamespaceNotEmptyException
- If the namespace is not emptyboolean setProperties(Namespace namespace, java.util.Map<java.lang.String,java.lang.String> properties) throws NoSuchNamespaceException
Properties that are not in the given map are not modified or removed by this method.
namespace
- a namespace. Namespace
properties
- a collection of metadata to apply to the namespaceNoSuchNamespaceException
- If the namespace does not exist (optional)java.lang.UnsupportedOperationException
- If namespace properties are not supportedboolean removeProperties(Namespace namespace, java.util.Set<java.lang.String> properties) throws NoSuchNamespaceException
Properties that are not in the given set are not modified or removed by this method.
namespace
- a namespace. Namespace
properties
- a collection of metadata to apply to the namespaceNoSuchNamespaceException
- If the namespace does not exist (optional)java.lang.UnsupportedOperationException
- If namespace properties are not supported