Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.34.0
-
None
Description
Consider query
select t1.deptno from empnullables t1 inner join empnullables t2 on coalesce(t1.ename, t2.ename) = 'abc'
When JoinDeriveIsNotNullFilterRule is applied to it, it is incorrectly transformed to query plan
LogicalProject(DEPTNO=[$7]) LogicalJoin(condition=[=(CASE(IS NOT NULL($1), $1, $10), 'abc')], joinType=[inner]) LogicalFilter(condition=[IS NOT NULL($1)]) LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]]) LogicalFilter(condition=[IS NOT NULL($1)]) LogicalTableScan(table=[[CATALOG, SALES, EMPNULLABLES]])
It is not valid to deduce that join keys from the both sides cannot have null values. All that we can deduce from the join condition, is that they cannot be null in the same time.
Attachments
Issue Links
- Blocked
-
CALCITE-6528 JoinUnifyRule may alter semantics in some cases
- Closed
- links to