Interface ViewChange

All Known Implementing Classes:
ViewChange.RemoveProperty, ViewChange.RenameView, ViewChange.ReplaceView, ViewChange.SetProperty

@Unstable public interface ViewChange
The ViewChange interface defines a change that can be applied to a view via ViewCatalog.alterView(org.apache.gravitino.NameIdentifier, ViewChange...).
  • Method Details

    • rename

      static ViewChange rename(String newName)
      Create a ViewChange for renaming a view.
      Parameters:
      newName - The new view name.
      Returns:
      A ViewChange for the rename.
    • setProperty

      static ViewChange setProperty(String property, String value)
      Create a ViewChange for setting a view property.

      If the property already exists, it will be replaced with the new value.

      Parameters:
      property - The property name.
      value - The new property value.
      Returns:
      A ViewChange for the addition.
    • removeProperty

      static ViewChange removeProperty(String property)
      Create a ViewChange for removing a view property.

      If the property does not exist, the change will succeed.

      Parameters:
      property - The property name.
      Returns:
      A ViewChange for the removal.
    • replaceView

      static ViewChange replaceView(Column[] columns, Representation[] representations, @Nullable String defaultCatalog, @Nullable String defaultSchema, @Nullable String comment)
      Create a ViewChange that atomically replaces the view body, i.e. its columns, representations, default catalog, default schema and comment. Properties and the view name are not affected by this change.

      The provided values are treated as a full replacement: any existing columns, representations and defaults are discarded. Callers that only intend to change a subset of the body should read the current values first and pass them back unchanged.

      Parameters:
      columns - The new output columns of the view.
      representations - The new representations of the view. At least one representation is expected.
      defaultCatalog - The new default catalog, or null to unset it.
      defaultSchema - The new default schema, or null to unset it.
      comment - The new comment, or null to unset it.
      Returns:
      A ViewChange for the replacement.