You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "wangsan (Jira)" <ji...@apache.org> on 2020/07/14 12:38:00 UTC

[jira] [Commented] (FLINK-18596) Derive format schema from table schema may get error result

    [ https://issues.apache.org/jira/browse/FLINK-18596?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17157334#comment-17157334 ] 

wangsan commented on FLINK-18596:
---------------------------------

I would like to fix this issue

> Derive format schema from table schema may get error result
> -----------------------------------------------------------
>
>                 Key: FLINK-18596
>                 URL: https://issues.apache.org/jira/browse/FLINK-18596
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / API
>    Affects Versions: 1.11.0
>            Reporter: wangsan
>            Priority: Major
>
> If rowtime attribute references a regular field, derive format schema from table schema may get error result:
> {code}
> Schema schema = new Schema()
> 	.field("f1", DataTypes.STRING())
> 	.field("f2", DataTypes.BIGINT()).from("t")
> 	.field("r", DataTypes.TIMESTAMP(3))
> 	.rowtime(
> 		new Rowtime().timestampsFromField("t").watermarksPeriodicBounded(3));
> final Map<String, String> properties = schema.toProperties();
> final TableSchema actualSchema = TableFormatFactoryBase.deriveSchema(properties);
> {code}
> this code snippet will result in `ValidationException("Field names must be unique. Duplicate field: '" + fullFieldName + "'")`, but the excepted result should be:
> {code}
> final TableSchema expectedSchema = TableSchema.builder()
> 	.field("f1", Types.STRING)
> 	.field("t", Types.LONG)
> 	.build();
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)