[ 
https://issues.apache.org/jira/browse/CALCITE-4150?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17172972#comment-17172972
 ] 

Julian Hyde edited comment on CALCITE-4150 at 8/7/20, 11:11 PM:
----------------------------------------------------------------

Fixed in 
[f813298b|https://github.com/apache/calcite/commit/f813298b67923e665fffee7bf4d388dcad994cb1].
 Thanks for the PR, [~anha]! (I was working on a duplicate bug and added some 
of my code to your PR.)


was (Author: julianhyde):
Fixed in 
[b3b3e06e|https://github.com/apache/calcite/commit/b3b3e06eef7eeedf2de32b44d061af7867633be6].
 Thanks for the PR, [~anha]! (I was working on a duplicate bug and added some 
of my code to your PR.)

> RelToSqlConverter does not support null without a cast: "Unsupported type 
> when convertTypeToSpec: NULL"
> -------------------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-4150
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4150
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.24.0
>            Reporter: Anton Haidai
>            Assignee: Anton Haidai
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.25.0
>
>          Time Spent: 1h 40m
>  Remaining Estimate: 0h
>
> RelToSqlConverterTest:
> {code:java}
>  @Test void testSelectNullNoCast() {
>   String query = "select \"product_id\", null as dummy from \"product\"";
>   final String expected = "SELECT \"product_id\", CAST(NULL AS NULL) AS 
> \"DUMMY\"\n"
>       + "FROM \"foodmart\".\"product\"";
>   sql(query).ok(expected);
> }{code}
> the test works fine in 1.23.
> result in 1.24:
> {code:java}
> Unsupported type when convertTypeToSpec: NULL
> java.lang.UnsupportedOperationException: Unsupported type when 
> convertTypeToSpec: NULL at 
> org.apache.calcite.sql.type.SqlTypeUtil.convertTypeToSpec(SqlTypeUtil.java:1078)
>  at org.apache.calcite.sql.SqlDialect.getCastSpec(SqlDialect.java:790) at 
> org.apache.calcite.rel.rel2sql.RelToSqlConverter.castNullType(RelToSqlConverter.java:361)
>  at 
> org.apache.calcite.rel.rel2sql.RelToSqlConverter.visit(RelToSqlConverter.java:342)
>  at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
> Method) at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>  at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  at java.base/java.lang.reflect.Method.invoke(Method.java:566) at 
> org.apache.calcite.util.ReflectUtil$2.invoke(ReflectUtil.java:524) at 
> org.apache.calcite.rel.rel2sql.RelToSqlConverter.dispatch(RelToSqlConverter.java:131){code}
> Please note, that there is an existing test "testSelectNull()", but it tests 
> nulls with a cast, "CAST(NULL AS INT)".



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to