[
https://issues.apache.org/jira/browse/CALCITE-4165?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Julian Hyde updated CALCITE-4165:
---------------------------------
Description:
RelToSqlConverter fails on literal, untyped nulls. Here is a simple test in
{{RelToSqlConverterTest}}:
{code:java}
@Test void testUntypedNull() {
final String sql = "SELECT NULL FROM \"warehouse_class\"";
final String expected = "SELECT NULL FROM \"warehouse_class\"";
sql(sql).ok(expected);
}{code}
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|https://github.com/apache/calcite/commit/ad53962f76a48e2627da1c155eb5f005150d3dcb])
:
{noformat}
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){noformat}
Seems to be an unintended side-effect of the fix for CALCITE-4066,
[8db7c9d6|https://github.com/apache/calcite/commit/8db7c9d6ddc317b5fee8705e136c0794c44b463a#diff-fe53d9c0364e000f0aeafa786587e815R1079].
was:
Simple test in RelToSqlConverterTest (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):
{code:java}
@Test void testUntypedNull() {
final String sql = "SELECT NULL FROM \"warehouse_class\"";
final String expected = "SELECT NULL FROM \"warehouse_class\"";
sql(sql).ok(expected);
}{code}
Stack trace (on current master
[ad53962f|https://github.com/apache/calcite/commit/ad53962f76a48e2627da1c155eb5f005150d3dcb])
:
{noformat}
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){noformat}
Seems to be an unintended side-effect of the fix for CALCITE-4066,
[8db7c9d6|https://github.com/apache/calcite/commit/8db7c9d6ddc317b5fee8705e136c0794c44b463a#diff-fe53d9c0364e000f0aeafa786587e815R1079].
> RelToSqlConverter fails on literal, untyped nulls
> -------------------------------------------------
>
> Key: CALCITE-4165
> URL: https://issues.apache.org/jira/browse/CALCITE-4165
> Project: Calcite
> Issue Type: Bug
> Reporter: Steven Talbot
> Assignee: Julian Hyde
> Priority: Major
>
> RelToSqlConverter fails on literal, untyped nulls. Here is a simple test in
> {{RelToSqlConverterTest}}:
>
> {code:java}
> @Test void testUntypedNull() {
> final String sql = "SELECT NULL FROM \"warehouse_class\"";
> final String expected = "SELECT NULL FROM \"warehouse_class\"";
> sql(sql).ok(expected);
> }{code}
> 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|https://github.com/apache/calcite/commit/ad53962f76a48e2627da1c155eb5f005150d3dcb])
> :
> {noformat}
> 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){noformat}
>
> Seems to be an unintended side-effect of the fix for CALCITE-4066,
> [8db7c9d6|https://github.com/apache/calcite/commit/8db7c9d6ddc317b5fee8705e136c0794c44b463a#diff-fe53d9c0364e000f0aeafa786587e815R1079].
--
This message was sent by Atlassian Jira
(v8.3.4#803005)