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

Yuzhao Chen updated CALCITE-2455:
---------------------------------
    Description: 
After CALCITE-2227, we will not replace Coalesce to Case When for natural join, 
when we use ReduceExpressionRule for our plan for Coalesce with constant, the 
nullability will chage( from nullable to notnull), this will cause 
VolcanoPlanner to throw error.

Should i fix this? or we should not use this rule in VolcanoPlanner?

This is the error thrown sql :
{code:java}
select * from lateral (select * from scott_emp) as e
    join (table scott_dept) using (deptno)
    where e.deptno = 10 {code}
The plan before ReduceExpressionRule:
{code:java}
LogicalProject(deptno=[COALESCE($7, $8)], empno=[$0], ename=[$1], job=[$2], 
mgr=    [$3], hiredate=[$4], sal=[$5], comm=[$6], dname=[$9], loc=[$10])
+- LogicalFilter(condition=[=($7, 10)])
+- LogicalJoin(condition=[=($7, $8)], joinType=[inner])
:- LogicalProject(empno=[$0], ename=[$1], job=[$2], mgr=[$3], hiredate=[$4], 
sal=[$5], comm=[$6], deptno=[$7])
: +- LogicalTableScan(table=[[scott_emp]])
+- LogicalProject(deptno=[$0], dname=[$1], loc=[$2])
+- LogicalTableScan(table=[[scott_dept]])
{code}

  was:
After CALCITE-2227, we will not replace Coalesce to Case When for natural join, 
when we use ReduceExpressionRule for our plan for Coalesce with constant, the 
nullability will chage( from nullable to notnull), this will cause 
VolcanoPlanner to throw error.

Should i fix this? or we should not use this rule in VolcanoPlanner?

This is the error thrown sql :
{code:java}
select * from lateral (select * from scott_emp) as e
    join (table scott_dept) using (deptno)
    where e.deptno = 10
{code}
 


> simplifyCoalesce of constant should match nullability
> -----------------------------------------------------
>
>                 Key: CALCITE-2455
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2455
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.17.0
>            Reporter: Yuzhao Chen
>            Assignee: Julian Hyde
>            Priority: Major
>             Fix For: 1.18.0
>
>
> After CALCITE-2227, we will not replace Coalesce to Case When for natural 
> join, when we use ReduceExpressionRule for our plan for Coalesce with 
> constant, the nullability will chage( from nullable to notnull), this will 
> cause VolcanoPlanner to throw error.
> Should i fix this? or we should not use this rule in VolcanoPlanner?
> This is the error thrown sql :
> {code:java}
> select * from lateral (select * from scott_emp) as e
>     join (table scott_dept) using (deptno)
>     where e.deptno = 10 {code}
> The plan before ReduceExpressionRule:
> {code:java}
> LogicalProject(deptno=[COALESCE($7, $8)], empno=[$0], ename=[$1], job=[$2], 
> mgr=    [$3], hiredate=[$4], sal=[$5], comm=[$6], dname=[$9], loc=[$10])
> +- LogicalFilter(condition=[=($7, 10)])
> +- LogicalJoin(condition=[=($7, $8)], joinType=[inner])
> :- LogicalProject(empno=[$0], ename=[$1], job=[$2], mgr=[$3], hiredate=[$4], 
> sal=[$5], comm=[$6], deptno=[$7])
> : +- LogicalTableScan(table=[[scott_emp]])
> +- LogicalProject(deptno=[$0], dname=[$1], loc=[$2])
> +- LogicalTableScan(table=[[scott_dept]])
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to