Skip to content

Commit d720618

Browse files
authored
[FLINK-38796][table] UnresolvedMetadataColumn misses type during serializing to string
1 parent a8bbcdc commit d720618

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

flink-python/pyflink/table/tests/test_schema.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ def test_schema_basic(self):
5151
`id` INT NOT NULL,
5252
`counter` INT NOT NULL,
5353
`payload` [ROW<name STRING, age INT, flag BOOLEAN>],
54-
`topic` METADATA VIRTUAL,
54+
`topic` STRING METADATA VIRTUAL,
5555
`ts` AS [orig_ts - INTERVAL '60' MINUTE],
56-
`orig_ts` METADATA FROM 'timestamp',
56+
`orig_ts` TIMESTAMP(3) METADATA FROM 'timestamp',
5757
`proctime` AS [PROCTIME()],
5858
WATERMARK FOR `ts` AS [ts - INTERVAL '5' SECOND],
5959
CONSTRAINT `primary_constraint` PRIMARY KEY (`id`) NOT ENFORCED

flink-table/flink-table-api-java/src/test/java/org/apache/flink/table/catalog/SchemaResolutionTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,9 +388,9 @@ void testUnresolvedSchemaString() {
388388
+ " `id` INT NOT NULL COMMENT 'people id',\n"
389389
+ " `counter` INT NOT NULL,\n"
390390
+ " `payload` [ROW<name STRING, age INT, flag BOOLEAN>],\n"
391-
+ " `topic` METADATA VIRTUAL COMMENT 'kafka topic',\n"
391+
+ " `topic` STRING METADATA VIRTUAL COMMENT 'kafka topic',\n"
392392
+ " `ts` AS [orig_ts - INTERVAL '60' MINUTE] COMMENT 'rowtime',\n"
393-
+ " `orig_ts` METADATA FROM 'timestamp' COMMENT 'the ''origin'' timestamp',\n"
393+
+ " `orig_ts` TIMESTAMP(3) METADATA FROM 'timestamp' COMMENT 'the ''origin'' timestamp',\n"
394394
+ " `proctime` AS [PROCTIME()],\n"
395395
+ " WATERMARK FOR `ts` AS [ts - INTERVAL '5' SECOND],\n"
396396
+ " CONSTRAINT `primary_constraint` PRIMARY KEY (`id`) NOT ENFORCED,\n"

flink-table/flink-table-common/src/main/java/org/apache/flink/table/api/Schema.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -948,8 +948,7 @@ public boolean isVirtual() {
948948
@Override
949949
public String toString() {
950950
final StringBuilder sb = new StringBuilder();
951-
sb.append(super.toString());
952-
sb.append(" METADATA");
951+
sb.append(String.format("%s %s METADATA", super.toString(), dataType.toString()));
953952
if (metadataKey != null) {
954953
sb.append(" FROM '");
955954
sb.append(EncodingUtils.escapeSingleQuotes(metadataKey));

flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/operations/SqlMaterializedTableNodeToOperationConverterTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,7 @@ private static Collection<TestSpec> alterSuccessCase() {
952952
+ " `c1` AS [CURRENT_TIMESTAMP],\n"
953953
+ " `a` BIGINT NOT NULL,\n"
954954
+ " `b` STRING,\n"
955-
+ " `topic` METADATA VIRTUAL COMMENT 'kafka topic',\n"
955+
+ " `topic` STRING METADATA VIRTUAL COMMENT 'kafka topic',\n"
956956
+ " `c` INT,\n"
957957
+ " `d` STRING,\n"
958958
+ " WATERMARK FOR `c1` AS [`c1` - INTERVAL '1' SECOND],\n"

0 commit comments

Comments
 (0)