Package org.apache.gravitino.rel
Interface ViewCatalog
The ViewCatalog interface defines the public API for managing views in a schema. If the catalog
implementation supports views, it must implement this interface.
-
Method Summary
Modifier and TypeMethodDescriptiondefault ViewalterView(NameIdentifier ident, ViewChange... changes) Apply thechangesto a view in the catalog.default ViewcreateView(NameIdentifier ident, String comment, Column[] columns, Representation[] representations, String defaultCatalog, String defaultSchema, Map<String, String> properties) Create a view in the catalog.default booleandropView(NameIdentifier ident) Drop a view from the catalog.default NameIdentifier[]List the views in a namespace from the catalog.loadView(NameIdentifier ident) Load view metadata byNameIdentifierfrom the catalog.default booleanviewExists(NameIdentifier ident) Check if a view exists using its identifier.
-
Method Details
-
listViews
List the views in a namespace from the catalog.This is a default method that throws
UnsupportedOperationException. Catalog implementations that support view management should override this method.- Parameters:
namespace- A namespace.- Returns:
- An array of view identifiers in the namespace.
- Throws:
NoSuchSchemaException- If the schema does not exist.
-
loadView
Load view metadata byNameIdentifierfrom the catalog.- Parameters:
ident- A view identifier.- Returns:
- The view metadata.
- Throws:
NoSuchViewException- If the view does not exist.
-
viewExists
Check if a view exists using its identifier.- Parameters:
ident- A view identifier.- Returns:
- true If the view exists, false otherwise.
-
createView
default View createView(NameIdentifier ident, @Nullable String comment, Column[] columns, Representation[] representations, @Nullable String defaultCatalog, @Nullable String defaultSchema, Map<String, String> properties) throws NoSuchSchemaException, ViewAlreadyExistsExceptionCreate a view in the catalog.This is a default method that throws
UnsupportedOperationException. Catalog implementations that support view management should override this method.- Parameters:
ident- A view identifier.comment- The view comment, may benull.columns- The output columns of the view.representations- The representations of the view. At least one representation is expected.defaultCatalog- The default catalog used to resolve unqualified identifiers referenced by the view definition, ornullif not set.defaultSchema- The default schema used to resolve unqualified identifiers referenced by the view definition, ornullif not set.properties- The view properties.- Returns:
- The created view metadata.
- Throws:
NoSuchSchemaException- If the schema does not exist.ViewAlreadyExistsException- If the view already exists.
-
alterView
default View alterView(NameIdentifier ident, ViewChange... changes) throws NoSuchViewException, IllegalArgumentException Apply thechangesto a view in the catalog.Implementations may reject the change. If any change is rejected, no changes should be applied to the view.
This is a default method that throws
UnsupportedOperationException. Catalog implementations that support view management should override this method.- Parameters:
ident- A view identifier.changes- View changes to apply to the view.- Returns:
- The updated view metadata.
- Throws:
NoSuchViewException- If the view does not exist.IllegalArgumentException- If the change is rejected by the implementation.
-
dropView
Drop a view from the catalog.This is a default method that throws
UnsupportedOperationException. Catalog implementations that support view management should override this method.- Parameters:
ident- A view identifier.- Returns:
- True if the view is dropped, false if the view does not exist.
-