[jira] [Updated] (CALCITE-7397) Error in simplifying join condition when creating LEFT MARK JOIN

2026-01-26 Thread Zhen Chen (Jira)


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

Zhen Chen updated CALCITE-7397:
---
Summary: Error in simplifying join condition when creating LEFT MARK JOIN  
(was: Error in simplifying join condition when creating left mark join)

> Error in simplifying join condition when creating LEFT MARK JOIN
> 
>
> Key: CALCITE-7397
> URL: https://issues.apache.org/jira/browse/CALCITE-7397
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Affects Versions: 1.41.0
>Reporter: Zhen Chen
>Priority: Major
>  Labels: pull-request-available
> Fix For: 1.42.0
>
>
> Using CoreQuidemTest2 to test the following SQL will result in an error.
> {code:java}
> select sal,
>   cast(null as int) IN (
> select cast(null as int)
> from "scott".dept)
> from "scott".emp;
> +-++
> | SAL | EXPR$1 |
> +-++
> | 1100.00 ||
> | 1250.00 ||
> | 1250.00 ||
> | 1300.00 ||
> | 1500.00 ||
> | 1600.00 ||
> | 2450.00 ||
> | 2850.00 ||
> | 2975.00 ||
> | 3000.00 ||
> | 3000.00 ||
> | 5000.00 ||
> |  800.00 ||
> |  950.00 ||
> +-++
> (14 rows)
> !ok {code}
> Error message:
> {code:java}
> > Error while executing command ExplainCommand [sql: select sal,
> >   cast(null as int) IN (
> > select cast(null as int)
> > from "scott".dept)
> > from "scott".emp]
> > java.lang.AssertionError: Cannot add expression of different type to set:
> > set type is RecordType(DECIMAL(7, 2) SAL, BOOLEAN EXPR$1) NOT NULL
> > expression type is RecordType(DECIMAL(7, 2) SAL, BOOLEAN NOT NULL EXPR$1) 
> > NOT NULL
> > set is rel#83813:LogicalProject.NONE.[](input=HepRelVertex#83812,exprs=[$5, 
> > IN(null:INTEGER, {
> > LogicalProject(EXPR$0=[null:INTEGER])
> >   LogicalTableScan(table=[[scott, DEPT]])
> > })])
> > expression is LogicalProject(SAL=[$5], EXPR$1=[$8])
> >   LogicalJoin(condition=[false], joinType=[left_mark])
> > LogicalTableScan(table=[[scott, EMP]])
> > LogicalProject(EXPR$0=[null:INTEGER])
> >   LogicalTableScan(table=[[scott, DEPT]])
> > Type mismatch:
> > rowtype of original rel: RecordType(DECIMAL(7, 2) SAL, BOOLEAN EXPR$1) NOT 
> > NULL
> > rowtype of new rel: RecordType(DECIMAL(7, 2) SAL, BOOLEAN NOT NULL EXPR$1) 
> > NOT NULL
> > Difference:
> > EXPR$1: BOOLEAN -> BOOLEAN NOT NULL {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Updated] (CALCITE-7397) Error in simplifying join condition when creating left mark join

2026-01-26 Thread Zhen Chen (Jira)


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

Zhen Chen updated CALCITE-7397:
---
Summary: Error in simplifying join condition when creating left mark join  
(was: TopDownGeneralDecorrelator can cause nullable property mismatches)

> Error in simplifying join condition when creating left mark join
> 
>
> Key: CALCITE-7397
> URL: https://issues.apache.org/jira/browse/CALCITE-7397
> Project: Calcite
>  Issue Type: Bug
>  Components: core
>Affects Versions: 1.41.0
>Reporter: Zhen Chen
>Priority: Major
>  Labels: pull-request-available
> Fix For: 1.42.0
>
>
> Using CoreQuidemTest2 to test the following SQL will result in an error.
> {code:java}
> select sal,
>   cast(null as int) IN (
> select cast(null as int)
> from "scott".dept)
> from "scott".emp;
> +-++
> | SAL | EXPR$1 |
> +-++
> | 1100.00 ||
> | 1250.00 ||
> | 1250.00 ||
> | 1300.00 ||
> | 1500.00 ||
> | 1600.00 ||
> | 2450.00 ||
> | 2850.00 ||
> | 2975.00 ||
> | 3000.00 ||
> | 3000.00 ||
> | 5000.00 ||
> |  800.00 ||
> |  950.00 ||
> +-++
> (14 rows)
> !ok {code}
> Error message:
> {code:java}
> > Error while executing command ExplainCommand [sql: select sal,
> >   cast(null as int) IN (
> > select cast(null as int)
> > from "scott".dept)
> > from "scott".emp]
> > java.lang.AssertionError: Cannot add expression of different type to set:
> > set type is RecordType(DECIMAL(7, 2) SAL, BOOLEAN EXPR$1) NOT NULL
> > expression type is RecordType(DECIMAL(7, 2) SAL, BOOLEAN NOT NULL EXPR$1) 
> > NOT NULL
> > set is rel#83813:LogicalProject.NONE.[](input=HepRelVertex#83812,exprs=[$5, 
> > IN(null:INTEGER, {
> > LogicalProject(EXPR$0=[null:INTEGER])
> >   LogicalTableScan(table=[[scott, DEPT]])
> > })])
> > expression is LogicalProject(SAL=[$5], EXPR$1=[$8])
> >   LogicalJoin(condition=[false], joinType=[left_mark])
> > LogicalTableScan(table=[[scott, EMP]])
> > LogicalProject(EXPR$0=[null:INTEGER])
> >   LogicalTableScan(table=[[scott, DEPT]])
> > Type mismatch:
> > rowtype of original rel: RecordType(DECIMAL(7, 2) SAL, BOOLEAN EXPR$1) NOT 
> > NULL
> > rowtype of new rel: RecordType(DECIMAL(7, 2) SAL, BOOLEAN NOT NULL EXPR$1) 
> > NOT NULL
> > Difference:
> > EXPR$1: BOOLEAN -> BOOLEAN NOT NULL {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)