You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Bowen Li (JIRA)" <ji...@apache.org> on 2019/07/22 15:18:00 UTC

[jira] [Closed] (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:all-tabpanel ]

Bowen Li closed FLINK-13313.
----------------------------
    Resolution: Fixed

merged in 1.10.0: b45becf8fc1d656874d9ffd4ad17b1276cf4b43f   1.9.0: b1b08916a7f0a93fb36291cce34580be419c7868

> 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: Major
>              Labels: pull-request-available
>             Fix For: 1.9.0, 1.10.0
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> 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)