lincoln lee created FLINK-28346: ----------------------------------- Summary: Wrong plan when selects metadata in a different order against ddl Key: FLINK-28346 URL: https://issues.apache.org/jira/browse/FLINK-28346 Project: Flink Issue Type: Bug Components: Table SQL / Planner Affects Versions: 1.15.0 Reporter: lincoln lee Fix For: 1.16.0
The following query will get a wrong plan: {code} @Test def testReadsMetaDataWithDifferentOrder(): Unit = { val ddl = s""" |CREATE TABLE src ( | id int, | name varchar, | tags varchar METADATA VIRTUAL, | op varchar METADATA VIRTUAL, | ts timestamp(3) METADATA VIRTUAL |) WITH ( | 'connector' = 'values', | 'readable-metadata'='tags:varchar,op:varchar,ts:timestamp(3)', | 'enable-projection-push-down' = 'false' |)""".stripMargin util.tableEnv.executeSql(ddl) util.verifyExecPlan("SELECT id, name, ts, tags, op FROM src") } {code} {code} Calc(select=[id, name, ts, CAST(tags AS VARCHAR(2147483647)) AS tags, CAST(op AS VARCHAR(2147483647)) AS op]) +- TableSourceScan(table=[[default_catalog, default_database, src]], fields=[id, name, op, tags, ts]) {code} -- This message was sent by Atlassian Jira (v8.20.10#820010)