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

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

wangsan created FLINK-18596:
-------------------------------

             Summary: 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


If rowtime attribute references a regular field, derive format schema from table schema may get error result:

```java
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);
``` 

this code snippet will result in `ValidationException("Field names must be unique. Duplicate field: '" + fullFieldName + "'")`, but the excepted result should be:

```java
TableSchema expectedSchema = TableSchema.builder()
	.field("f1", Types.STRING)
	.field("t", Types.LONG)
	.build();
```



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