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:23:00 UTC
[jira] [Updated] (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:all-tabpanel ]
wangsan updated FLINK-18596:
----------------------------
Description:
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}
was:
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();
```
> 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)