hailin0 opened a new pull request, #2855: URL: https://github.com/apache/calcite/pull/2855
https://issues.apache.org/jira/browse/CALCITE-5214 The following test: ```java //org.apache.calcite.test.SqlToRelConverterTest @Test void testUnionNullableImplicitTypeCoercion() { final String sql = "select id from (values(1), (null)) t (id) union select 'varchar-id' as id"; sql(sql).ok(); } ``` Fails with the following exception: ```java Exception in thread "main" java.lang.AssertionError: Conversion to relational algebra failed to preserve datatypes: validated type: RecordType(VARCHAR NOT NULL ID) NOT NULL converted type: RecordType(VARCHAR EXPR$0) NOT NULL rel: LogicalUnion(all=[false]) LogicalProject(EXPR$0=[CAST($0):VARCHAR]) LogicalValues(tuples=[[{ 1 }, { null }]]) LogicalValues(tuples=[[{ 'varchar-id' }]]) at org.apache.calcite.sql2rel.SqlToRelConverter.checkConvertedType(SqlToRelConverter.java:486) at org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:601) at org.apache.calcite.prepare.PlannerImpl.rel(PlannerImpl.java:259) ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@calcite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org