[ https://issues.apache.org/jira/browse/FLINK-37850?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sergey Nuyanzin updated FLINK-37850: ------------------------------------ Description: Example of failing query {code:scala} val sqlQuery = """ | SELECT id, ts, name, timestamp_col, timestamp_ltz_col FROM t2 | UNION ALL | SELECT id, ts, name, timestamp_col, timestamp_ltz_col FROM t3 | UNION ALL | SELECT id, ts, timestamp_col as wrong_column_type, timestamp_col, timestamp_ltz_col FROM t2 """.stripMargin util.verifyRelPlanWithType(sqlQuery) {code} fails with {noformat} Caused by: java.lang.UnsupportedOperationException: class org.apache.calcite.sql.SqlBasicCall: SELECT `t2`.`id`, `t2`.`ts`, `t2`.`name`, `t2`.`timestamp_col`, `t2`.`timestamp_ltz_col` FROM `default_catalog`.`default_database`.`t2` AS `t2` UNION ALL SELECT `t3`.`id`, `t3`.`ts`, `t3`.`name`, `t3`.`timestamp_col`, `t3`.`timestamp_ltz_col` FROM `default_catalog`.`default_database`.`t3` AS `t3` {noformat} the root cause is issue in Calcite (fixed in 1.40) CALCITE-7027 was: Example of failing query {code:scala} val sqlQuery = """ | SELECT id, ts, name, timestamp_col, timestamp_ltz_col FROM t2 | UNION ALL | SELECT id, ts, name, timestamp_col, timestamp_ltz_col FROM t3 | UNION ALL | SELECT id, ts, timestamp_col as wrong_column_type, timestamp_col, timestamp_ltz_col FROM t2 """.stripMargin util.verifyRelPlanWithType(sqlQuery) {code} the root cause is issue in Calcite (fixed in 1.40) CALCITE-7027 > Several Union, Except, Intersect with one wrong column type fail with > UnsupportedOperationException > --------------------------------------------------------------------------------------------------- > > Key: FLINK-37850 > URL: https://issues.apache.org/jira/browse/FLINK-37850 > Project: Flink > Issue Type: Improvement > Components: Table SQL / Planner > Reporter: Sergey Nuyanzin > Assignee: Sergey Nuyanzin > Priority: Major > > Example of failing query > {code:scala} > val sqlQuery = > """ > | SELECT id, ts, name, timestamp_col, timestamp_ltz_col FROM t2 > | UNION ALL > | SELECT id, ts, name, timestamp_col, timestamp_ltz_col FROM t3 > | UNION ALL > | SELECT id, ts, timestamp_col as wrong_column_type, timestamp_col, > timestamp_ltz_col FROM t2 > """.stripMargin > util.verifyRelPlanWithType(sqlQuery) > {code} > fails with > {noformat} > Caused by: java.lang.UnsupportedOperationException: class > org.apache.calcite.sql.SqlBasicCall: SELECT `t2`.`id`, `t2`.`ts`, > `t2`.`name`, `t2`.`timestamp_col`, `t2`.`timestamp_ltz_col` > FROM `default_catalog`.`default_database`.`t2` AS `t2` > UNION ALL > SELECT `t3`.`id`, `t3`.`ts`, `t3`.`name`, `t3`.`timestamp_col`, > `t3`.`timestamp_ltz_col` > FROM `default_catalog`.`default_database`.`t3` AS `t3` > {noformat} > the root cause is issue in Calcite (fixed in 1.40) > CALCITE-7027 -- This message was sent by Atlassian Jira (v8.20.10#820010)