Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

@PublicEvolving
public interface Catalog {

    /**
* When using the Create Table As Select(CTAS) feature,
was used, the Catalog combined* {
@link Catalog#supportsManagedTable}
* planner will use this API to infer whetherthe todefault addoptions somefor optionsTable to avoid the {@link CatalogBaseTable}failure to generate TableSink.
*
* For example:
* {@link JdbcCatalog} can add connector = 'jdbc', user, password, url and other options to {@link CatalogBaseTable},
* {@link HiveCatalog} can add connector = 'hive' to {@link CatalogBaseTable}, help generate TableSink.
* The tables in {@link GenericInMemoryCatalog} already exist externally,

* options must be filled in manually by the user, and the Catalog cannot be automatically inferred.
*/
default CatalogBaseTable inferTableOptions(ObjectPath tablePath, CatalogBaseTable table) {
       * <p>Example:
* <pre>{@code
* // If the user does not set any Table's options,
* // then the implementation of JdbcCatalog#inferTableOptions
* // can be like this to avoid the execution failure.
* public void inferTableOptions(ObjectPath tablePath, CatalogBaseTable table) {
* Map<String, String> tableOptions = table.getOptions();
* tableOptions.put("connector", "jdbc");
* tableOptions.put("url", getBaseUrl());
* tableOptions.put("table-name", tablePath.getObjectName());
* tableOptions.put("username", getUsername());
* tableOptions.put("password", getPassword());
* }
* }</pre>
*/
default void inferTableOptions(ObjectPath tablePath, CatalogBaseTable table) {
throw new UnsupportedOperationException();
}

}

Catalog#inferTableOptions is convenient for users to customize the Catalog, and when it supports the CTAS function, the options of the table can be automatically inferred to avoid job failure due to lack of information.

...