Interface ViewCatalog


@Unstable public 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 Details

    • listViews

      default NameIdentifier[] listViews(Namespace namespace) throws NoSuchSchemaException
      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

      View loadView(NameIdentifier ident) throws NoSuchViewException
      Load view metadata by NameIdentifier from the catalog.
      Parameters:
      ident - A view identifier.
      Returns:
      The view metadata.
      Throws:
      NoSuchViewException - If the view does not exist.
    • viewExists

      default boolean viewExists(NameIdentifier ident)
      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, ViewAlreadyExistsException
      Create 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 be null.
      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, or null if not set.
      defaultSchema - The default schema used to resolve unqualified identifiers referenced by the view definition, or null if 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 the changes to 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

      default boolean dropView(NameIdentifier ident)
      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.