Zhen Chen created CALCITE-7396:
----------------------------------

             Summary: PruneEmptyRules does not support LEFT_MARK JOIN
                 Key: CALCITE-7396
                 URL: https://issues.apache.org/jira/browse/CALCITE-7396
             Project: Calcite
          Issue Type: Bug
          Components: core
    Affects Versions: 1.41.0
            Reporter: Zhen Chen
            Assignee: Zhen Chen
             Fix For: 1.42.0


Running CoreQuidemTest2 will produce the following results and plan. The 
following results and plans are all wrong.
{code:java}
select * from dept where deptno not in (select deptno from emp where false);
+--------+-------+
| DEPTNO | DNAME |
+--------+-------+
+--------+-------+
(0 rows)

!ok
EnumerableValues(tuples=[[]])
!plan {code}
After removing the PruneEmptyRules.JOIN_RIGHT_INSTANCE rule, the following plan 
will be obtained.
{code:java}
select * from dept where deptno not in (select deptno from emp where false);
+--------+-------------+
| DEPTNO | DNAME       |
+--------+-------------+
|     10 | Sales       |
|     20 | Marketing   |
|     30 | Engineering |
|     40 | Empty       |
+--------+-------------+
(4 rows)

!ok
EnumerableCalc(expr#0..2=[{inputs}], expr#3=[NOT($t2)], proj#0..1=[{exprs}], 
$condition=[$t3])
  EnumerableHashJoin(condition=[=($0, $2)], joinType=[left_mark])
    EnumerableValues(tuples=[[{ 10, 'Sales      ' }, { 20, 'Marketing  ' }, { 
30, 'Engineering' }, { 40, 'Empty      ' }]])
    EnumerableValues(tuples=[[]])
!plan {code}
Therefore, we should fix the PruneEmptyRules.JOIN_RIGHT_INSTANCE rule to make 
it compatible with LEFT_MARK JOIN.



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

Reply via email to