[ 
https://issues.apache.org/jira/browse/CALCITE-4756?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

duan xiong updated CALCITE-4756:
--------------------------------
    Description: 
When I try to design some unit tests for CALCITE-4742. I found Calcite can't 
handle NULL very well in some subquery.

For example: 
{code:java}
select 1 in (values(null),(null))
ERROR:
    java.lang.AssertionError: Conversion to relational algebra failed to 
preserve datatypes:
    validated type:
    RecordType(BOOLEAN NOT NULL EXPR$0) NOT NULL
    converted type:
    RecordType(BOOLEAN EXPR$0) NOT NULL
    rel:
    LogicalProject(EXPR$0=[IN(1, {
    LogicalValues(tuples=[[{ null }]])
    })])
      LogicalValues(tuples=[[{ 0 }]])
select 1 > some(values(null),(null))
ERROR:
    Suppressed: java.lang.RuntimeException: while resolving method 'voidValue' 
in class class java.lang.Void{code}
This SQL should return NULL. But throw the runtime exception.

  was:
When I try to design some unit tests for CALCITE-4742. I found Calcite can't 
handle NULL very well in some subquery.

For example: 
{code:java}
select 1 in (values(null),(null))
select 1 > some(values(null),(null))
{code}
This SQL should return NULL. But throw the runtime exception.


> When subquery include NULL value, Calcite should return the right result
> ------------------------------------------------------------------------
>
>                 Key: CALCITE-4756
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4756
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.27.0
>            Reporter: duan xiong
>            Assignee: duan xiong
>            Priority: Major
>
> When I try to design some unit tests for CALCITE-4742. I found Calcite can't 
> handle NULL very well in some subquery.
> For example: 
> {code:java}
> select 1 in (values(null),(null))
> ERROR:
>     java.lang.AssertionError: Conversion to relational algebra failed to 
> preserve datatypes:
>     validated type:
>     RecordType(BOOLEAN NOT NULL EXPR$0) NOT NULL
>     converted type:
>     RecordType(BOOLEAN EXPR$0) NOT NULL
>     rel:
>     LogicalProject(EXPR$0=[IN(1, {
>     LogicalValues(tuples=[[{ null }]])
>     })])
>       LogicalValues(tuples=[[{ 0 }]])
> select 1 > some(values(null),(null))
> ERROR:
>     Suppressed: java.lang.RuntimeException: while resolving method 
> 'voidValue' in class class java.lang.Void{code}
> This SQL should return NULL. But throw the runtime exception.



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

Reply via email to