You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Timo Walther (JIRA)" <ji...@apache.org> on 2019/07/18 08:57:00 UTC
[jira] [Commented] (FLINK-13313) create CatalogTableBuilder to
support building CatalogTable from descriptors
[ https://issues.apache.org/jira/browse/FLINK-13313?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16887768#comment-16887768 ]
Timo Walther commented on FLINK-13313:
--------------------------------------
Thanks for working on this [~phoenixjiangnan]. This builder makes totally sense. But this sounds more like a feature to me. It should definitely not be a blocker for an entire release. I will change its priority.
> create CatalogTableBuilder to support building CatalogTable from descriptors
> ----------------------------------------------------------------------------
>
> Key: FLINK-13313
> URL: https://issues.apache.org/jira/browse/FLINK-13313
> Project: Flink
> Issue Type: Sub-task
> Components: Table SQL / API
> Affects Versions: 1.9.0, 1.10.0
> Reporter: Bowen Li
> Assignee: Bowen Li
> Priority: Blocker
> Fix For: 1.9.0, 1.10.0
>
>
> Found a usability issue.
> Previously, users can create an ExternalCatalogTable (deprecated) from descriptors via ExternalCatalogTableBuilder, and this helps smooth user experience of Flink Table API. E.g.
> {code:java}
> ExternalCatalogTable table = ExternalCatalogTableBuilder(
> new ExternalSystemXYZ()
> .version("0.11"))
> .withFormat(
> new Json()
> .jsonSchema("{...}")
> .failOnMissingField(false))
> 。withSchema(
> new Schema()
> .field("user-name", "VARCHAR").from("u_name")
> .field("count", "DECIMAL")
> .supportsStreaming()
> .asTableSource()
> oldCatalog.createTable("tble_name", table, false)
> {code}
> If we don't have a builder to connect new CatalogTable and descriptor, how a user creates CatalogTable would be like the following example, which is quite inconvenient given users have to know all the key names.
> {code:java}
> TableSchema schema = TableSchema.builder()
> .field("name", DataTypes.STRING())
> .field("age", DataTypes.INT())
> .build();
> Map<String, String> properties = new HashMap<>();
> properties.put(CatalogConfig.IS_GENERIC, String.valueOf(true));
> properties.put("connector.type", "filesystem");
> properties.put("connector.path", "/tmp");
> properties.put("connector.property-version", "1");
> properties.put("update-mode", "append");
> properties.put("format.type", "csv");
> properties.put("format.property-version", "1");
> properties.put("format.fields.0.name", "name");
> properties.put("format.fields.0.type", "STRING");
> properties.put("format.fields.1.name", "age");
> properties.put("format.fields.1.type", "INT");
> ObjectPath path = new ObjectPath("mydb", "mytable");
> CatalogTable table = new CatalogTableImpl(schema, properties, "csv table");
> {code}
> We need a similar new class {{CatalogTableBuilder}} for new Catalog APIs
> cc [~tzulitai] [~ykt836] [~xuefuz]
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)