You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "xiong duan (Jira)" <ji...@apache.org> on 2022/02/25 01:12:00 UTC
[jira] [Created] (CALCITE-5021) Double JOIN is created for NOT IN when IN-list that the values all non-nullable is converted to Values
xiong duan created CALCITE-5021:
-----------------------------------
Summary: Double JOIN is created for NOT IN when IN-list that the values all non-nullable is converted to Values
Key: CALCITE-5021
URL: https://issues.apache.org/jira/browse/CALCITE-5021
Project: Calcite
Issue Type: Bug
Components: core
Affects Versions: 1.29.0
Reporter: xiong duan
Fix For: 1.30.0
Double JOIN is created for NOT IN when IN-list that the values all non-nullable is converted to Values.
For example:
{code:java}
select * from "scott".emp where (empno, deptno) not in ((7369, 20), (7499, 30));{code}
Before fix(Double Join):
{noformat}
EnumerableCalc(expr#0..14=[{inputs}], expr#15=[0:BIGINT], expr#16=[=($t8, $t15)], expr#17=[IS NULL($t14)], expr#18=[>=($t9, $t8)], expr#19=[IS NOT NULL($t11)], expr#20=[AND($t17, $t18, $t19)], expr#21=[OR($t16, $t20)], proj#0..7=[{exprs}], $condition=[$t21])
EnumerableMergeJoin(condition=[AND(=($10, $12), =($11, $13))], joinType=[left])
EnumerableSort(sort0=[$10], sort1=[$11], dir0=[ASC], dir1=[ASC])
EnumerableCalc(expr#0..9=[{inputs}], proj#0..9=[{exprs}], EMPNO0=[$t0], DEPTNO0=[/$t7])
EnumerableNestedLoopJoin(condition=[true], joinType=[inner])
EnumerableTableScan(table=[[scott, EMP]])
EnumerableAggregate(group=[{}], agg#0=[COUNT()], agg#1=[COUNT($1)])
EnumerableValues(tuples=[[{ 7369, 20 }, { 7499, 30 }]])
EnumerableSort(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC])
EnumerableCalc(expr#0..1=[{inputs}], expr#2=[true], proj#0..2=[{exprs}])
EnumerableValues(tuples=[[{ 7369, 20 }, { 7499, 30 }]]){noformat}
After Fix:
{noformat}
EnumerableCalc(expr#0..12=[{inputs}], expr#13=[IS NOT TRUE($t12)], expr#14=[IS NULL($t9)], expr#15=[OR($t13, $t14)], proj#0..7=[{exprs}], $condition=[$t15])
EnumerableMergeJoin(condition=[AND(=($8, $10), =($9, $11))], joinType=[left])
EnumerableSort(sort0=[$8], sort1=[$9], dir0=[ASC], dir1=[ASC])
EnumerableCalc(expr#0..7=[{inputs}], proj#0..7=[{exprs}], EMPNO0=[$t0], DEPTNO0=[$t7])
EnumerableTableScan(table=[[scott, EMP]])
EnumerableSort(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC])
EnumerableCalc(expr#0..1=[{inputs}], expr#2=[true], proj#0..2=[{exprs}])
EnumerableValues(tuples=[[{ 7369, 20 }, { 7499, 30 }]]){noformat}
--
This message was sent by Atlassian Jira
(v8.20.1#820001)