This is an automated email from the ASF dual-hosted git repository. twalthr pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/flink.git
commit 5aec41d77e03f81d7d5e55d12040d09b301b1411 Author: Timo Walther <[email protected]> AuthorDate: Thu Apr 30 10:29:25 2020 +0200 [hotfix][table-common] Improve terminology around catalog table options --- flink-python/pyflink/table/catalog.py | 13 +++++++++++++ .../apache/flink/table/catalog/CatalogBaseTable.java | 18 +++++++++++++++--- .../org/apache/flink/table/catalog/CatalogTable.java | 14 +++++++------- 3 files changed, 35 insertions(+), 10 deletions(-) diff --git a/flink-python/pyflink/table/catalog.py b/flink-python/pyflink/table/catalog.py index 5fcd859..9d3a7d3 100644 --- a/flink-python/pyflink/table/catalog.py +++ b/flink-python/pyflink/table/catalog.py @@ -618,10 +618,23 @@ class CatalogBaseTable(object): def _get(j_catalog_base_table): return CatalogBaseTable(j_catalog_base_table) + def get_options(self): + """ + Returns a map of string-based options. + + In case of CatalogTable, these options may determine the kind of connector and its + configuration for accessing the data in the external system. + + :return: Property map of the table/view. + """ + return dict(self._j_catalog_base_table.getOptions()) + def get_properties(self): """ Get the properties of the table. + This method is deprecated. Use :func:`~pyflink.table.CatalogBaseTable.get_options` instead. + :return: Property map of the table/view. """ return dict(self._j_catalog_base_table.getProperties()) diff --git a/flink-table/flink-table-common/src/main/java/org/apache/flink/table/catalog/CatalogBaseTable.java b/flink-table/flink-table-common/src/main/java/org/apache/flink/table/catalog/CatalogBaseTable.java index e2157e0..3d3a9aa 100644 --- a/flink-table/flink-table-common/src/main/java/org/apache/flink/table/catalog/CatalogBaseTable.java +++ b/flink-table/flink-table-common/src/main/java/org/apache/flink/table/catalog/CatalogBaseTable.java @@ -19,6 +19,7 @@ package org.apache.flink.table.catalog; import org.apache.flink.table.api.TableSchema; +import org.apache.flink.table.factories.DynamicTableFactory; import java.util.Map; import java.util.Optional; @@ -28,14 +29,25 @@ import java.util.Optional; * key-value pairs defining the properties of the table. */ public interface CatalogBaseTable { + /** - * Get the properties of the table. - * - * @return property map of the table/view + * @deprecated Use {@link #getOptions()}. */ + @Deprecated Map<String, String> getProperties(); /** + * Returns a map of string-based options. + * + * <p>In case of {@link CatalogTable}, these options may determine the kind of connector and its + * configuration for accessing the data in the external system. See {@link DynamicTableFactory} + * for more information. + */ + default Map<String, String> getOptions() { + return getProperties(); + } + + /** * Get the schema of the table. * * @return schema of the table/view. diff --git a/flink-table/flink-table-common/src/main/java/org/apache/flink/table/catalog/CatalogTable.java b/flink-table/flink-table-common/src/main/java/org/apache/flink/table/catalog/CatalogTable.java index 2f55880..fb51e1e 100644 --- a/flink-table/flink-table-common/src/main/java/org/apache/flink/table/catalog/CatalogTable.java +++ b/flink-table/flink-table-common/src/main/java/org/apache/flink/table/catalog/CatalogTable.java @@ -40,17 +40,17 @@ public interface CatalogTable extends CatalogBaseTable { List<String> getPartitionKeys(); /** - * Return a property map for table factory discovery purpose. The properties will be used to match a [[TableFactory]]. - * Please refer to {@link org.apache.flink.table.factories.TableFactory} + * Returns a copy of this {@code CatalogTable} with given table options {@code options}. * - * @return a map of properties + * @return a new copy of this table with replaced table options */ - Map<String, String> toProperties(); + CatalogTable copy(Map<String, String> options); /** - * Returns a copy of this {@code CatalogTable} with given table options {@code options}. + * Serializes this instance into a map of string-based properties. * - * @return a new copy of this table with replaced table options + * <p>Compared to the pure table options in {@link #getOptions()}, the map includes schema, + * partitioning, and other characteristics in a serialized form. */ - CatalogTable copy(Map<String, String> options); + Map<String, String> toProperties(); }
