Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Duplicate
-
None
-
None
Description
RelToSqlConverter fails on literal, untyped nulls. Here is a simple test in RelToSqlConverterTest:
@Test void testUntypedNull() { final String sql = "SELECT NULL FROM \"warehouse_class\""; final String expected = "SELECT NULL FROM \"warehouse_class\""; sql(sql).ok(expected); }
The expected SQL is probably not exactly the right expected SQL, but the test explodes on 1.24 so it doesn't matter for our purposes. Here is the top of the stack trace (on current master ad53962f) :
Unsupported type when convertTypeToSpec: NULLUnsupported type when convertTypeToSpec: NULL java.lang.UnsupportedOperationException: Unsupported type when convertTypeToSpec: NULL at org.apache.calcite.sql.type.SqlTypeUtil.convertTypeToSpec(SqlTypeUtil.java:1027) at org.apache.calcite.sql.SqlDialect.getCastSpec(SqlDialect.java:778) at org.apache.calcite.rel.rel2sql.RelToSqlConverter.castNullType(RelToSqlConverter.java:361)
Seems to be an unintended side-effect of the fix for CALCITE-4066, 8db7c9d6.
Attachments
Issue Links
- duplicates
-
CALCITE-4150 RelToSqlConverter does not support null without a cast: "Unsupported type when convertTypeToSpec: NULL"
- Closed
- is broken by
-
CALCITE-4066 SqlTypeUtil#convertTypeToSpec cover Array/Multiset/Row types
- Closed
- is related to
-
CALCITE-3210 JDBC adapter should generate "CAST(NULL AS type)" rather than "NULL"
- Closed
- links to