Interface SupportsSchemas


@Evolving public interface SupportsSchemas
The client interface to support schema operations. The server side should use the other one with the same name in the core module.
  • Method Details

    • listSchemas

      String[] listSchemas() throws NoSuchCatalogException
      List schemas under the entity.

      If an entity such as a table, view exists, its parent schemas must also exist and must be returned by this discovery method. For example, if table a.b.t exists, this method invoked as listSchemas(a) must return [b] in the result array

      Returns:
      An array of schema names under the namespace.
      Throws:
      NoSuchCatalogException - If the catalog does not exist.
    • schemaExists

      default boolean schemaExists(String schemaName)
      Check if a schema exists.

      If an entity such as a table, view exists, its parent namespaces must also exist. For example, if table a.b.t exists, this method invoked as schemaExists(a.b) must return true.

      Parameters:
      schemaName - The name of the schema.
      Returns:
      True if the schema exists, false otherwise.
    • createSchema

      Schema createSchema(String schemaName, String comment, Map<String,String> properties) throws NoSuchCatalogException, SchemaAlreadyExistsException
      Creates a schema in the catalog based on the provided details.

      This method returns the schema as defined by the user without applying all defaults. If you need the schema with default values applied, use the loadSchema(String) method after creation.

      Parameters:
      schemaName - The name of the schema.
      comment - The comment of the schema.
      properties - The properties of the schema.
      Returns:
      The schema as defined by the caller, without all default values.
      Throws:
      NoSuchCatalogException - If the catalog does not exist.
      SchemaAlreadyExistsException - If the schema already exists.
    • loadSchema

      Schema loadSchema(String schemaName) throws NoSuchSchemaException
      Load metadata properties for a schema.
      Parameters:
      schemaName - The name of the schema.
      Returns:
      A schema.
      Throws:
      NoSuchSchemaException - If the schema does not exist (optional).
    • alterSchema

      Schema alterSchema(String schemaName, SchemaChange... changes) throws NoSuchSchemaException
      Apply the metadata change to a schema in the catalog.
      Parameters:
      schemaName - The name of the schema.
      changes - The metadata changes to apply.
      Returns:
      The altered schema.
      Throws:
      NoSuchSchemaException - If the schema does not exist.
    • dropSchema

      boolean dropSchema(String schemaName, boolean cascade) throws NonEmptySchemaException
      Drop a schema from the catalog. If cascade option is true, recursively drop all objects within the schema.

      If the catalog implementation does not support this operation, it may throw UnsupportedOperationException.

      Parameters:
      schemaName - The name of the schema.
      cascade - If true, recursively drop all objects within the schema.
      Returns:
      True if the schema exists and is dropped successfully, false if the schema doesn't exist.
      Throws:
      NonEmptySchemaException - If the schema is not empty and cascade is false.