@DeveloperApi public interface ViewCatalog extends CatalogPlugin
Modifier and Type | Field and Description |
---|---|
static String |
PROP_COMMENT
A reserved property to specify the description of the view.
|
static String |
PROP_CREATE_ENGINE_VERSION
A reserved property to specify the software version used to create the view.
|
static String |
PROP_ENGINE_VERSION
A reserved property to specify the software version used to change the view.
|
static String |
PROP_OWNER
A reserved property to specify the owner of the view.
|
static java.util.List<String> |
RESERVED_PROPERTIES
All reserved properties of the view.
|
Modifier and Type | Method and Description |
---|---|
View |
alterView(Identifier ident,
ViewChange... changes)
Apply
changes to a view in the catalog. |
View |
createView(Identifier ident,
String sql,
String currentCatalog,
String[] currentNamespace,
StructType schema,
String[] queryColumnNames,
String[] columnAliases,
String[] columnComments,
java.util.Map<String,String> properties)
Create a view in the catalog.
|
boolean |
dropView(Identifier ident)
Drop a view in the catalog.
|
default void |
invalidateView(Identifier ident)
Invalidate cached view metadata for an
identifier . |
Identifier[] |
listViews(String... namespace)
List the views in a namespace from the catalog.
|
View |
loadView(Identifier ident)
Load view metadata by
ident from the catalog. |
void |
renameView(Identifier oldIdent,
Identifier newIdent)
Rename a view in the catalog.
|
default boolean |
viewExists(Identifier ident)
Test whether a view exists using an
identifier from the catalog. |
defaultNamespace, initialize, name
static final String PROP_COMMENT
static final String PROP_OWNER
static final String PROP_CREATE_ENGINE_VERSION
static final String PROP_ENGINE_VERSION
static final java.util.List<String> RESERVED_PROPERTIES
Identifier[] listViews(String... namespace) throws org.apache.spark.sql.catalyst.analysis.NoSuchNamespaceException
If the catalog supports tables, this must return identifiers for only views and not tables.
namespace
- a multi-part namespaceorg.apache.spark.sql.catalyst.analysis.NoSuchNamespaceException
- If the namespace does not exist (optional).View loadView(Identifier ident) throws org.apache.spark.sql.catalyst.analysis.NoSuchViewException
ident
from the catalog.
If the catalog supports tables and contains a table for the identifier and not a view,
this must throw NoSuchViewException
.
ident
- a view identifierorg.apache.spark.sql.catalyst.analysis.NoSuchViewException
- If the view doesn't exist or is a tabledefault void invalidateView(Identifier ident)
identifier
.
If the view is already loaded or cached, drop cached data. If the view does not exist or is not cached, do nothing. Calling this method should not query remote services.
ident
- a view identifierdefault boolean viewExists(Identifier ident)
identifier
from the catalog.
If the catalog supports views and contains a view for the identifier and not a table, this must return false.
ident
- a view identifierView createView(Identifier ident, String sql, String currentCatalog, String[] currentNamespace, StructType schema, String[] queryColumnNames, String[] columnAliases, String[] columnComments, java.util.Map<String,String> properties) throws org.apache.spark.sql.catalyst.analysis.ViewAlreadyExistsException, org.apache.spark.sql.catalyst.analysis.NoSuchNamespaceException
ident
- a view identifiersql
- the SQL text that defines the viewcurrentCatalog
- the current catalogcurrentNamespace
- the current namespaceschema
- the view query output schemaqueryColumnNames
- the query column namescolumnAliases
- the column aliasescolumnComments
- the column commentsproperties
- the view propertiesorg.apache.spark.sql.catalyst.analysis.ViewAlreadyExistsException
- If a view or table already exists for the identifierorg.apache.spark.sql.catalyst.analysis.NoSuchNamespaceException
- If the identifier namespace does not exist (optional)View alterView(Identifier ident, ViewChange... changes) throws org.apache.spark.sql.catalyst.analysis.NoSuchViewException, IllegalArgumentException
changes
to a view in the catalog.
Implementations may reject the requested changes. If any change is rejected, none of the changes should be applied to the view.
ident
- a view identifierchanges
- an array of changes to apply to the vieworg.apache.spark.sql.catalyst.analysis.NoSuchViewException
- If the view doesn't exist or is a table.IllegalArgumentException
- If any change is rejected by the implementation.boolean dropView(Identifier ident)
If the catalog supports tables and contains a table for the identifier and not a view, this must not drop the table and must return false.
ident
- a view identifiervoid renameView(Identifier oldIdent, Identifier newIdent) throws org.apache.spark.sql.catalyst.analysis.NoSuchViewException, org.apache.spark.sql.catalyst.analysis.ViewAlreadyExistsException
If the catalog supports tables and contains a table with the old identifier, this throws
NoSuchViewException
. Additionally, if it contains a table with the new identifier,
this throws ViewAlreadyExistsException
.
If the catalog does not support view renames between namespaces, it throws
UnsupportedOperationException
.
oldIdent
- the view identifier of the existing view to renamenewIdent
- the new view identifier of the vieworg.apache.spark.sql.catalyst.analysis.NoSuchViewException
- If the view to rename doesn't exist or is a tableorg.apache.spark.sql.catalyst.analysis.ViewAlreadyExistsException
- If the new view name already exists or is a tableUnsupportedOperationException
- If the namespaces of old and new identifiers do not
match (optional)