Class CatalogManager

java.lang.Object
org.apache.flink.table.catalog.CatalogManager
All Implemented Interfaces:
AutoCloseable, CatalogRegistry

@Internal public final class CatalogManager extends Object implements CatalogRegistry, AutoCloseable
A manager for dealing with catalog objects such as tables, views, functions, and types. It encapsulates all available catalogs and stores temporary objects.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    Builder for a fluent definition of a CatalogManager.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    alterCatalog(String catalogName, org.apache.flink.table.catalog.CatalogChange catalogChange)
    Alters a catalog under the given name.
    void
    alterDatabase(String catalogName, String databaseName, org.apache.flink.table.catalog.CatalogDatabase newDatabase, boolean ignoreIfNotExists)
    Modify an existing database.
    void
    alterModel(org.apache.flink.table.catalog.CatalogModel modelChange, org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier, boolean ignoreIfNotExists)
    Alters a model in a given fully qualified path.
    void
    alterTable(org.apache.flink.table.catalog.CatalogBaseTable table, List<org.apache.flink.table.catalog.TableChange> changes, org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier, boolean ignoreIfNotExists)
    Alters a table in a given fully qualified path with table changes.
    void
    alterTable(org.apache.flink.table.catalog.CatalogBaseTable table, org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier, boolean ignoreIfNotExists)
    Alters a table in a given fully qualified path.
    void
    Closes the catalog manager and releases its resources.
    void
    createCatalog(String catalogName, org.apache.flink.table.catalog.CatalogDescriptor catalogDescriptor)
     
    void
    createCatalog(String catalogName, org.apache.flink.table.catalog.CatalogDescriptor catalogDescriptor, boolean ignoreIfExists)
    Creates a catalog under the given name.
    void
    createDatabase(String catalogName, String databaseName, org.apache.flink.table.catalog.CatalogDatabase database, boolean ignoreIfExists)
    Create a database.
    void
    createModel(org.apache.flink.table.catalog.CatalogModel model, org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier, boolean ignoreIfExists)
    Creates a model in a given fully qualified path.
    boolean
    createTable(org.apache.flink.table.catalog.CatalogBaseTable table, org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier, boolean ignoreIfExists)
    Creates a table in a given fully qualified path.
    void
    createTemporaryModel(org.apache.flink.table.catalog.CatalogModel model, org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier, boolean ignoreIfExists)
    Creates a temporary model in a given fully qualified path.
    void
    createTemporaryTable(org.apache.flink.table.catalog.CatalogBaseTable table, org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier, boolean ignoreIfExists)
    Creates a temporary table in a given fully qualified path.
    void
    dropDatabase(String catalogName, String databaseName, boolean ignoreIfNotExists, boolean cascade)
    Drop a database.
    boolean
    dropMaterializedTable(org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier, boolean ignoreIfNotExists)
    Drops a materialized table in a given fully qualified path.
    void
    dropModel(org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier, boolean ignoreIfNotExists)
    Drops a model in a given fully qualified path.
    boolean
    dropTable(org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier, boolean ignoreIfNotExists)
    Drops a table in a given fully qualified path.
    void
    dropTemporaryModel(org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier, boolean ignoreIfNotExists)
    Drop a temporary model in a given fully qualified path.
    void
    dropTemporaryTable(org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier, boolean ignoreIfNotExists)
    Drop a temporary table in a given fully qualified path.
    void
    dropTemporaryView(org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier, boolean ignoreIfNotExists)
    Drop a temporary view in a given fully qualified path.
    boolean
    dropView(org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier, boolean ignoreIfNotExists)
    Drops a view in a given fully qualified path.
    Gets the built-in catalog name.
    Gets the built-in database name in the built-in catalog.
    Optional<org.apache.flink.table.catalog.Catalog>
    getCatalog(String catalogName)
    Gets a Catalog instance by name.
    Optional<org.apache.flink.table.catalog.ResolvedCatalogBaseTable<?>>
    getCatalogBaseTable(org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier)
    Retrieves a fully qualified table.
    Optional<org.apache.flink.table.catalog.CatalogDescriptor>
     
     
    org.apache.flink.table.catalog.Catalog
    Gets a catalog by name.
    org.apache.flink.table.catalog.Catalog
     
    Gets the current catalog that will be used when resolving table path.
    Gets the current database name that will be used when resolving table path.
    org.apache.flink.table.catalog.DataTypeFactory
    Returns a factory for creating fully resolved data types that can be used for planning.
    getModel(org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier)
    Retrieves a fully qualified model.
    getModelOrError(org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier)
    Like getModel(ObjectIdentifier), but throws an error when the model is not available in any of the catalogs.
    Optional<org.apache.flink.table.catalog.CatalogPartition>
    getPartition(org.apache.flink.table.catalog.ObjectIdentifier tableIdentifier, org.apache.flink.table.catalog.CatalogPartitionSpec partitionSpec)
    Retrieves a partition with a fully qualified table path and partition spec.
    org.apache.flink.table.catalog.SchemaResolver
    Returns a SchemaResolver for creating ResolvedSchema from Schema.
    getTable(org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier)
    Retrieves a fully qualified table.
    getTable(org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier, long timestamp)
    Retrieves a fully qualified table with a specific time.
    getTableOrError(org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier)
    Like getTable(ObjectIdentifier), but throws an error when the table is not available in any of the catalogs.
    protected Optional<org.apache.flink.table.catalog.TemporaryOperationListener>
    getTemporaryOperationListener(org.apache.flink.table.catalog.ObjectIdentifier identifier)
     
    void
    initSchemaResolver(boolean isStreamingMode, ExpressionResolver.ExpressionResolverBuilder expressionResolverBuilder, Parser parser)
    Initializes a SchemaResolver for Schema resolution.
    boolean
    isTemporaryModel(org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier)
    Return whether the model with a fully qualified table path is temporary or not.
    boolean
    isTemporaryTable(org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier)
    Return whether the table with a fully qualified table path is temporary or not.
    Retrieves the set of names of all registered catalogs, including all initialized catalogs and all catalogs stored in the CatalogStore.
    Returns an array of names of all models registered in the namespace of the current catalog and database.
    listModels(String catalogName, String databaseName)
    Returns an array of names of all models registered in the namespace of the given catalog and database.
    Lists all available schemas in the root of the catalog manager.
    listSchemas(String catalogName)
    Lists all available schemas in the given catalog.
    Returns an array of names of all tables (tables and views, both temporary and permanent) registered in the namespace of the current catalog and database.
    listTables(String catalogName, String databaseName)
    Returns an array of names of all tables (tables and views, both temporary and permanent) registered in the namespace of the given catalog and database.
    Returns an array of names of temporary tables registered in the namespace of the current catalog and database.
    Returns an array of names of temporary views registered in the namespace of the current catalog and database.
    Returns an array of names of all views(both temporary and permanent) registered in the namespace of the current catalog and database.
    listViews(String catalogName, String databaseName)
    Returns an array of names of all views(both temporary and permanent) registered in the namespace of the given catalog and database.
     
    qualifyCatalog(String catalogName)
    Qualifies catalog name.
    qualifyDatabase(String databaseName)
    Qualifies database name.
    org.apache.flink.table.catalog.ObjectIdentifier
    qualifyIdentifier(org.apache.flink.table.catalog.UnresolvedIdentifier identifier)
    Returns the full name of the given table path, this name may be padded with current catalog/database name based on the identifier's length.
    void
    registerCatalog(String catalogName, org.apache.flink.table.catalog.Catalog catalog)
    Deprecated.
    This method is deprecated and will be removed in a future release.
    org.apache.flink.table.catalog.ResolvedCatalogBaseTable<?>
    resolveCatalogBaseTable(org.apache.flink.table.catalog.CatalogBaseTable baseTable)
    Resolves a CatalogBaseTable to a validated ResolvedCatalogBaseTable.
    org.apache.flink.table.catalog.ResolvedCatalogMaterializedTable
    resolveCatalogMaterializedTable(org.apache.flink.table.catalog.CatalogMaterializedTable table)
    Resolves a CatalogMaterializedTable to a validated ResolvedCatalogMaterializedTable.
    org.apache.flink.table.catalog.ResolvedCatalogModel
    resolveCatalogModel(org.apache.flink.table.catalog.CatalogModel model)
     
    org.apache.flink.table.catalog.ResolvedCatalogTable
    resolveCatalogTable(org.apache.flink.table.catalog.CatalogTable table)
    Resolves a CatalogTable to a validated ResolvedCatalogTable.
    org.apache.flink.table.catalog.ResolvedCatalogView
    resolveCatalogView(org.apache.flink.table.catalog.CatalogView view)
    Resolves a CatalogView to a validated ResolvedCatalogView.
    boolean
    schemaExists(String catalogName)
    Checks if there is a catalog with given name or is there a temporary object registered within a given catalog.
    boolean
    schemaExists(String catalogName, String databaseName)
    Checks if there is a database with given name in a given catalog or is there a temporary object registered within a given catalog and database.
    void
    Sets the current catalog name that will be used when resolving table path.
    void
    setCurrentDatabase(String databaseName)
    Sets the current database name that will be used when resolving a table path.
    void
    unregisterCatalog(String catalogName, boolean ignoreIfNotExists)
    Unregisters a catalog under the given name.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getCatalogModificationListeners

      @VisibleForTesting public List<CatalogModificationListener> getCatalogModificationListeners()
    • getCatalogDescriptor

      public Optional<org.apache.flink.table.catalog.CatalogDescriptor> getCatalogDescriptor(String catalogName)
    • newBuilder

      public static CatalogManager.Builder newBuilder()
    • close

      public void close() throws org.apache.flink.table.catalog.exceptions.CatalogException
      Closes the catalog manager and releases its resources.

      This method closes all initialized catalogs and the catalog store.

      Specified by:
      close in interface AutoCloseable
      Throws:
      org.apache.flink.table.catalog.exceptions.CatalogException - if an error occurs while closing the catalogs or the catalog store
    • initSchemaResolver

      public void initSchemaResolver(boolean isStreamingMode, ExpressionResolver.ExpressionResolverBuilder expressionResolverBuilder, Parser parser)
      Initializes a SchemaResolver for Schema resolution.

      Currently, the resolver cannot be passed in the constructor because of a chicken-and-egg problem between Planner and CatalogManager.

      See Also:
    • getSchemaResolver

      public org.apache.flink.table.catalog.SchemaResolver getSchemaResolver()
      Returns a SchemaResolver for creating ResolvedSchema from Schema.
    • getDataTypeFactory

      public org.apache.flink.table.catalog.DataTypeFactory getDataTypeFactory()
      Returns a factory for creating fully resolved data types that can be used for planning.
    • createCatalog

      public void createCatalog(String catalogName, org.apache.flink.table.catalog.CatalogDescriptor catalogDescriptor, boolean ignoreIfExists) throws org.apache.flink.table.catalog.exceptions.CatalogException
      Creates a catalog under the given name. The catalog name must be unique.
      Parameters:
      catalogName - the given catalog name under which to create the given catalog
      catalogDescriptor - catalog descriptor for creating catalog
      ignoreIfExists - if false exception will be thrown if a catalog exists.
      Throws:
      org.apache.flink.table.catalog.exceptions.CatalogException - If the catalog already exists in the catalog store or initialized catalogs, or if an error occurs while creating the catalog or storing the CatalogDescriptor
    • createCatalog

      public void createCatalog(String catalogName, org.apache.flink.table.catalog.CatalogDescriptor catalogDescriptor)
    • alterCatalog

      public void alterCatalog(String catalogName, org.apache.flink.table.catalog.CatalogChange catalogChange) throws org.apache.flink.table.catalog.exceptions.CatalogException
      Alters a catalog under the given name. The catalog name must be unique.
      Parameters:
      catalogName - the given catalog name under which to alter the given catalog
      catalogChange - catalog change to update the underlying catalog descriptor
      Throws:
      org.apache.flink.table.catalog.exceptions.CatalogException - If the catalog neither exists in the catalog store nor in the initialized catalogs, or if an error occurs while creating the catalog or storing the CatalogDescriptor
    • registerCatalog

      @Deprecated public void registerCatalog(String catalogName, org.apache.flink.table.catalog.Catalog catalog)
      Deprecated.
      This method is deprecated and will be removed in a future release. Use createCatalog instead to create a catalog using CatalogDescriptor and store it in the CatalogStore.
      Registers a catalog under the given name. The catalog name must be unique.
      Parameters:
      catalogName - name under which to register the given catalog
      catalog - catalog to register
      Throws:
      org.apache.flink.table.catalog.exceptions.CatalogException - if the registration of the catalog under the given name failed
    • unregisterCatalog

      public void unregisterCatalog(String catalogName, boolean ignoreIfNotExists)
      Unregisters a catalog under the given name. The catalog name must be existed.

      If the catalog is in the initialized catalogs, it will be removed from the initialized catalogs. If the catalog is stored in the CatalogStore, it will be removed from the CatalogStore.

      Parameters:
      catalogName - name under which to unregister the given catalog.
      ignoreIfNotExists - If false exception will be thrown if the table or database or catalog to be altered does not exist.
      Throws:
      org.apache.flink.table.catalog.exceptions.CatalogException - If the catalog does not exist in the initialized catalogs and not in the CatalogStore, or if the remove operation failed.
    • getCatalog

      public Optional<org.apache.flink.table.catalog.Catalog> getCatalog(String catalogName)
      Gets a Catalog instance by name.

      If the catalog has already been initialized, the initialized instance will be returned directly. Otherwise, the CatalogDescriptor will be obtained from the CatalogStore, and the catalog instance will be initialized.

      Parameters:
      catalogName - name of the catalog to retrieve
      Returns:
      the requested catalog or empty if it does not exist
    • getCatalogOrThrowException

      public org.apache.flink.table.catalog.Catalog getCatalogOrThrowException(String catalogName)
    • getCatalogOrError

      public org.apache.flink.table.catalog.Catalog getCatalogOrError(String catalogName) throws org.apache.flink.table.api.CatalogNotExistException
      Gets a catalog by name.
      Specified by:
      getCatalogOrError in interface CatalogRegistry
      Parameters:
      catalogName - name of the catalog to retrieve
      Returns:
      the requested catalog
      Throws:
      org.apache.flink.table.api.CatalogNotExistException - if the catalog does not exist
    • getCurrentCatalog

      @Nullable public String getCurrentCatalog()
      Gets the current catalog that will be used when resolving table path.
      Specified by:
      getCurrentCatalog in interface CatalogRegistry
      Returns:
      the current catalog
      See Also:
    • setCurrentCatalog

      public void setCurrentCatalog(@Nullable String catalogName) throws org.apache.flink.table.api.CatalogNotExistException
      Sets the current catalog name that will be used when resolving table path.
      Parameters:
      catalogName - catalog name to set as current catalog
      Throws:
      org.apache.flink.table.api.CatalogNotExistException - thrown if the catalog doesn't exist
      See Also:
    • getCurrentDatabase

      @Nullable public String getCurrentDatabase()
      Gets the current database name that will be used when resolving table path.
      Specified by:
      getCurrentDatabase in interface CatalogRegistry
      Returns:
      the current database
      See Also:
    • setCurrentDatabase

      public void setCurrentDatabase(@Nullable String databaseName)
      Sets the current database name that will be used when resolving a table path. The database has to exist in the current catalog.
      Parameters:
      databaseName - database name to set as current database name
      Throws:
      org.apache.flink.table.catalog.exceptions.CatalogException - thrown if the database doesn't exist in the current catalog
      See Also:
    • getBuiltInCatalogName

      public String getBuiltInCatalogName()
      Gets the built-in catalog name. The built-in catalog is used for storing all non-serializable transient meta-objects.
      Returns:
      the built-in catalog name
    • getBuiltInDatabaseName

      public String getBuiltInDatabaseName()
      Gets the built-in database name in the built-in catalog. The built-in database is used for storing all non-serializable transient meta-objects.
      Returns:
      the built-in database name
    • getTable

      public Optional<ContextResolvedTable> getTable(org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier)
      Retrieves a fully qualified table. If the path is not yet fully qualified use qualifyIdentifier(UnresolvedIdentifier) first.
      Parameters:
      objectIdentifier - full path of the table to retrieve
      Returns:
      table that the path points to.
    • getTable

      public Optional<ContextResolvedTable> getTable(org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier, long timestamp)
      Retrieves a fully qualified table with a specific time. If the path is not yet fully qualified, use qualifyIdentifier(UnresolvedIdentifier) first.
      Parameters:
      objectIdentifier - full path of the table to retrieve
      timestamp - Timestamp of the table snapshot, which is milliseconds since 1970-01-01 00:00:00 UTC
      Returns:
      table at a specific time that the path points to.
    • getCatalogBaseTable

      public Optional<org.apache.flink.table.catalog.ResolvedCatalogBaseTable<?>> getCatalogBaseTable(org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier)
      Retrieves a fully qualified table. If the path is not yet fully qualified use qualifyIdentifier(UnresolvedIdentifier) first.
      Specified by:
      getCatalogBaseTable in interface CatalogRegistry
      Parameters:
      objectIdentifier - full path of the table to retrieve
      Returns:
      resolved table that the path points to or empty if it does not exist.
    • isTemporaryTable

      public boolean isTemporaryTable(org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier)
      Return whether the table with a fully qualified table path is temporary or not.
      Specified by:
      isTemporaryTable in interface CatalogRegistry
      Parameters:
      objectIdentifier - full path of the table
      Returns:
      the table is temporary or not.
    • getTableOrError

      public ContextResolvedTable getTableOrError(org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier)
      Like getTable(ObjectIdentifier), but throws an error when the table is not available in any of the catalogs.
    • getPartition

      public Optional<org.apache.flink.table.catalog.CatalogPartition> getPartition(org.apache.flink.table.catalog.ObjectIdentifier tableIdentifier, org.apache.flink.table.catalog.CatalogPartitionSpec partitionSpec)
      Retrieves a partition with a fully qualified table path and partition spec. If the path is not yet fully qualified usequalifyIdentifier(UnresolvedIdentifier) first.
      Specified by:
      getPartition in interface CatalogRegistry
      Parameters:
      tableIdentifier - full path of the table to retrieve
      partitionSpec - full partition spec
      Returns:
      partition in the table.
    • listCatalogs

      public Set<String> listCatalogs()
      Retrieves the set of names of all registered catalogs, including all initialized catalogs and all catalogs stored in the CatalogStore.
      Returns:
      a set of names of registered catalogs
    • listTables

      public Set<String> listTables()
      Returns an array of names of all tables (tables and views, both temporary and permanent) registered in the namespace of the current catalog and database.
      Returns:
      names of all registered tables
    • listTables

      public Set<String> listTables(String catalogName, String databaseName)
      Returns an array of names of all tables (tables and views, both temporary and permanent) registered in the namespace of the given catalog and database.
      Returns:
      names of all registered tables
    • listTemporaryTables

      public Set<String> listTemporaryTables()
      Returns an array of names of temporary tables registered in the namespace of the current catalog and database.
      Returns:
      names of registered temporary tables
    • listTemporaryViews

      public Set<String> listTemporaryViews()
      Returns an array of names of temporary views registered in the namespace of the current catalog and database.
      Returns:
      names of registered temporary views
    • listViews

      public Set<String> listViews()
      Returns an array of names of all views(both temporary and permanent) registered in the namespace of the current catalog and database.
      Returns:
      names of all registered views
    • listViews

      public Set<String> listViews(String catalogName, String databaseName)
      Returns an array of names of all views(both temporary and permanent) registered in the namespace of the given catalog and database.
      Returns:
      names of registered views
    • listSchemas

      public Set<String> listSchemas()
      Lists all available schemas in the root of the catalog manager. It is not equivalent to listing all catalogs as it includes also different catalog parts of the temporary objects.

      NOTE:It is primarily used for interacting with Calcite's schema.

      Returns:
      set of schemas in the root of catalog manager
    • listSchemas

      public Set<String> listSchemas(String catalogName)
      Lists all available schemas in the given catalog. It is not equivalent to listing databases within the given catalog as it includes also different database parts of the temporary objects identifiers.

      NOTE:It is primarily used for interacting with Calcite's schema.

      Parameters:
      catalogName - filter for the catalog part of the schema
      Returns:
      set of schemas with the given prefix
    • schemaExists

      public boolean schemaExists(String catalogName)
      Checks if there is a catalog with given name or is there a temporary object registered within a given catalog.

      NOTE:It is primarily used for interacting with Calcite's schema.

      Parameters:
      catalogName - filter for the catalog part of the schema
      Returns:
      true if a subschema exists
    • schemaExists

      public boolean schemaExists(String catalogName, String databaseName)
      Checks if there is a database with given name in a given catalog or is there a temporary object registered within a given catalog and database.

      NOTE:It is primarily used for interacting with Calcite's schema.

      Parameters:
      catalogName - filter for the catalog part of the schema
      databaseName - filter for the database part of the schema
      Returns:
      true if a subschema exists
    • qualifyIdentifier

      public org.apache.flink.table.catalog.ObjectIdentifier qualifyIdentifier(org.apache.flink.table.catalog.UnresolvedIdentifier identifier)
      Returns the full name of the given table path, this name may be padded with current catalog/database name based on the identifier's length.
      Specified by:
      qualifyIdentifier in interface CatalogRegistry
      Parameters:
      identifier - an unresolved identifier
      Returns:
      a fully qualified object identifier
    • qualifyCatalog

      public String qualifyCatalog(@Nullable String catalogName)
      Qualifies catalog name. Throws ValidationException if not set.
    • qualifyDatabase

      public String qualifyDatabase(@Nullable String databaseName)
      Qualifies database name. Throws ValidationException if not set.
    • createTable

      public boolean createTable(org.apache.flink.table.catalog.CatalogBaseTable table, org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier, boolean ignoreIfExists)
      Creates a table in a given fully qualified path.
      Parameters:
      table - The table to put in the given path.
      objectIdentifier - The fully qualified path where to put the table.
      ignoreIfExists - If false exception will be thrown if a table exists in the given path.
      Returns:
      true if table was created in the given path, false if a table already exists in the given path.
    • createTemporaryTable

      public void createTemporaryTable(org.apache.flink.table.catalog.CatalogBaseTable table, org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier, boolean ignoreIfExists)
      Creates a temporary table in a given fully qualified path.
      Parameters:
      table - The table to put in the given path.
      objectIdentifier - The fully qualified path where to put the table.
      ignoreIfExists - if false exception will be thrown if a table exists in the given path.
    • dropTemporaryTable

      public void dropTemporaryTable(org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier, boolean ignoreIfNotExists)
      Drop a temporary table in a given fully qualified path.
      Parameters:
      objectIdentifier - The fully qualified path of the table to drop.
      ignoreIfNotExists - If false exception will be thrown if the table to be dropped does not exist.
    • dropTemporaryView

      public void dropTemporaryView(org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier, boolean ignoreIfNotExists)
      Drop a temporary view in a given fully qualified path.
      Parameters:
      objectIdentifier - The fully qualified path of the view to drop.
      ignoreIfNotExists - If false exception will be thrown if the view to be dropped does not exist.
    • getTemporaryOperationListener

      protected Optional<org.apache.flink.table.catalog.TemporaryOperationListener> getTemporaryOperationListener(org.apache.flink.table.catalog.ObjectIdentifier identifier)
    • alterTable

      public void alterTable(org.apache.flink.table.catalog.CatalogBaseTable table, org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier, boolean ignoreIfNotExists)
      Alters a table in a given fully qualified path.
      Parameters:
      table - The table to put in the given path
      objectIdentifier - The fully qualified path where to alter the table.
      ignoreIfNotExists - If false exception will be thrown if the table or database or catalog to be altered does not exist.
    • alterTable

      public void alterTable(org.apache.flink.table.catalog.CatalogBaseTable table, List<org.apache.flink.table.catalog.TableChange> changes, org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier, boolean ignoreIfNotExists)
      Alters a table in a given fully qualified path with table changes.
      Parameters:
      table - The table to put in the given path
      changes - The table changes from the original table to the new table.
      objectIdentifier - The fully qualified path where to alter the table.
      ignoreIfNotExists - If false exception will be thrown if the table or database or catalog to be altered does not exist.
    • dropTable

      public boolean dropTable(org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier, boolean ignoreIfNotExists)
      Drops a table in a given fully qualified path.
      Parameters:
      objectIdentifier - The fully qualified path of the table to drop.
      ignoreIfNotExists - If false exception will be thrown if the table to drop does not exist.
      Returns:
      true if table existed in the given path and was dropped, false if table didn't exist in the given path and ignoreIfNotExists was true.
    • dropMaterializedTable

      public boolean dropMaterializedTable(org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier, boolean ignoreIfNotExists)
      Drops a materialized table in a given fully qualified path.
      Parameters:
      objectIdentifier - The fully qualified path of the materialized table to drop.
      ignoreIfNotExists - If false exception will be thrown if the table to drop does not exist.
      Returns:
      true if materialized table existed in the given path and was dropped, false if materialized table didn't exist in the given path and ignoreIfNotExists was true.
    • dropView

      public boolean dropView(org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier, boolean ignoreIfNotExists)
      Drops a view in a given fully qualified path.
      Parameters:
      objectIdentifier - The fully qualified path of the view to drop.
      ignoreIfNotExists - If false exception will be thrown if the view to drop does not exist.
      Returns:
      true if view existed in the given path and was dropped, false if view didn't exist in the given path and ignoreIfNotExists was true.
    • getModel

      public Optional<ContextResolvedModel> getModel(org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier)
      Retrieves a fully qualified model. If the path is not yet fully qualified use qualifyIdentifier(UnresolvedIdentifier) first.
      Parameters:
      objectIdentifier - full path of the model to retrieve
      Returns:
      model that the path points to.
    • getModelOrError

      public ContextResolvedModel getModelOrError(org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier)
      Like getModel(ObjectIdentifier), but throws an error when the model is not available in any of the catalogs.
    • isTemporaryModel

      public boolean isTemporaryModel(org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier)
      Return whether the model with a fully qualified table path is temporary or not.
      Parameters:
      objectIdentifier - full path of the table
      Returns:
      the model is temporary or not.
    • listModels

      public Set<String> listModels()
      Returns an array of names of all models registered in the namespace of the current catalog and database.
      Returns:
      names of all registered models
    • listModels

      public Set<String> listModels(String catalogName, String databaseName)
      Returns an array of names of all models registered in the namespace of the given catalog and database.
      Returns:
      names of all registered models
    • createModel

      public void createModel(org.apache.flink.table.catalog.CatalogModel model, org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier, boolean ignoreIfExists)
      Creates a model in a given fully qualified path.
      Parameters:
      model - The resolved model to put in the given path.
      objectIdentifier - The fully qualified path where to put the model.
      ignoreIfExists - If false exception will be thrown if a model exists in the given path.
    • createTemporaryModel

      public void createTemporaryModel(org.apache.flink.table.catalog.CatalogModel model, org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier, boolean ignoreIfExists)
      Creates a temporary model in a given fully qualified path.
      Parameters:
      model - The resolved model to put in the given path.
      objectIdentifier - The fully qualified path where to put the model.
      ignoreIfExists - if false exception will be thrown if a model exists in the given path.
    • alterModel

      public void alterModel(org.apache.flink.table.catalog.CatalogModel modelChange, org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier, boolean ignoreIfNotExists)
      Alters a model in a given fully qualified path.
      Parameters:
      modelChange - The model containing only changes
      objectIdentifier - The fully qualified path where to alter the model.
      ignoreIfNotExists - If false exception will be thrown if the model to be altered does not exist.
    • dropModel

      public void dropModel(org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier, boolean ignoreIfNotExists)
      Drops a model in a given fully qualified path.
      Parameters:
      objectIdentifier - The fully qualified path of the model to drop.
      ignoreIfNotExists - If false exception will be thrown if the model to drop does not exist.
    • dropTemporaryModel

      public void dropTemporaryModel(org.apache.flink.table.catalog.ObjectIdentifier objectIdentifier, boolean ignoreIfNotExists)
      Drop a temporary model in a given fully qualified path.
      Parameters:
      objectIdentifier - The fully qualified path of the model to drop.
      ignoreIfNotExists - If false exception will be thrown if the model to be dropped does not exist.
    • resolveCatalogModel

      public org.apache.flink.table.catalog.ResolvedCatalogModel resolveCatalogModel(org.apache.flink.table.catalog.CatalogModel model)
    • resolveCatalogBaseTable

      public org.apache.flink.table.catalog.ResolvedCatalogBaseTable<?> resolveCatalogBaseTable(org.apache.flink.table.catalog.CatalogBaseTable baseTable)
      Resolves a CatalogBaseTable to a validated ResolvedCatalogBaseTable.
    • resolveCatalogTable

      public org.apache.flink.table.catalog.ResolvedCatalogTable resolveCatalogTable(org.apache.flink.table.catalog.CatalogTable table)
      Resolves a CatalogTable to a validated ResolvedCatalogTable.
    • resolveCatalogMaterializedTable

      public org.apache.flink.table.catalog.ResolvedCatalogMaterializedTable resolveCatalogMaterializedTable(org.apache.flink.table.catalog.CatalogMaterializedTable table)
      Resolves a CatalogMaterializedTable to a validated ResolvedCatalogMaterializedTable.
    • resolveCatalogView

      public org.apache.flink.table.catalog.ResolvedCatalogView resolveCatalogView(org.apache.flink.table.catalog.CatalogView view)
      Resolves a CatalogView to a validated ResolvedCatalogView.
    • createDatabase

      public void createDatabase(String catalogName, String databaseName, org.apache.flink.table.catalog.CatalogDatabase database, boolean ignoreIfExists) throws org.apache.flink.table.catalog.exceptions.DatabaseAlreadyExistException, org.apache.flink.table.catalog.exceptions.CatalogException
      Create a database.
      Parameters:
      catalogName - Name of the catalog for database
      databaseName - Name of the database to be created
      database - The database definition
      ignoreIfExists - Flag to specify behavior when a database with the given name already exists: if set to false, throw a DatabaseAlreadyExistException, if set to true, do nothing.
      Throws:
      org.apache.flink.table.catalog.exceptions.DatabaseAlreadyExistException - if the given database already exists and ignoreIfExists is false
      org.apache.flink.table.catalog.exceptions.CatalogException - in case of any runtime exception
    • dropDatabase

      public void dropDatabase(String catalogName, String databaseName, boolean ignoreIfNotExists, boolean cascade) throws org.apache.flink.table.catalog.exceptions.DatabaseNotExistException, org.apache.flink.table.catalog.exceptions.DatabaseNotEmptyException, org.apache.flink.table.catalog.exceptions.CatalogException
      Drop a database.
      Parameters:
      catalogName - Name of the catalog for database.
      databaseName - Name of the database to be dropped.
      ignoreIfNotExists - Flag to specify behavior when the database does not exist: if set to false, throw an exception, if set to true, do nothing.
      cascade - Flag to specify behavior when the database contains table or function: if set to true, delete all tables and functions in the database and then delete the database, if set to false, throw an exception.
      Throws:
      org.apache.flink.table.catalog.exceptions.DatabaseNotExistException - if the given database does not exist
      org.apache.flink.table.catalog.exceptions.DatabaseNotEmptyException - if the given database is not empty and isRestrict is true
      org.apache.flink.table.catalog.exceptions.CatalogException - in case of any runtime exception
    • alterDatabase

      public void alterDatabase(String catalogName, String databaseName, org.apache.flink.table.catalog.CatalogDatabase newDatabase, boolean ignoreIfNotExists) throws org.apache.flink.table.catalog.exceptions.DatabaseNotExistException, org.apache.flink.table.catalog.exceptions.CatalogException
      Modify an existing database.
      Parameters:
      catalogName - Name of the catalog for database
      databaseName - Name of the database to be dropped
      newDatabase - The new database definition
      ignoreIfNotExists - Flag to specify behavior when the given database does not exist: if set to false, throw an exception, if set to true, do nothing.
      Throws:
      org.apache.flink.table.catalog.exceptions.DatabaseNotExistException - if the given database does not exist
      org.apache.flink.table.catalog.exceptions.CatalogException - in case of any runtime exception