You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by zh...@apache.org on 2026/01/28 03:34:41 UTC

(calcite) branch main updated: [CALCITE-7400] PruneJoinSingleValue rule causes type mismatch in IN

This is an automated email from the ASF dual-hosted git repository.

zhenchen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/calcite.git


The following commit(s) were added to refs/heads/main by this push:
     new 077d355ec3 [CALCITE-7400] PruneJoinSingleValue rule causes type mismatch in IN
077d355ec3 is described below

commit 077d355ec337aba4272b7adfbcc982629839883e
Author: Zhen Chen <cz...@163.com>
AuthorDate: Tue Jan 27 20:08:21 2026 +0800

    [CALCITE-7400] PruneJoinSingleValue rule causes type mismatch in IN
---
 .../calcite/rel/rules/SingleValuesOptimizationRules.java     |  6 ++++--
 core/src/test/resources/sql/new-decorr.iq                    | 12 ++++++++++++
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/core/src/main/java/org/apache/calcite/rel/rules/SingleValuesOptimizationRules.java b/core/src/main/java/org/apache/calcite/rel/rules/SingleValuesOptimizationRules.java
index 3212e98686..d0e53be44d 100644
--- a/core/src/main/java/org/apache/calcite/rel/rules/SingleValuesOptimizationRules.java
+++ b/core/src/main/java/org/apache/calcite/rel/rules/SingleValuesOptimizationRules.java
@@ -284,9 +284,11 @@ static Predicate<Join> isJoinTransformable(boolean isLeft) {
           || jn.getJoinType() == JoinRelType.FULL;
 
       if (isLeft) {
-        return jn -> !(jn.getJoinType() == JoinRelType.LEFT || isFullOrAntiJoin.test(jn));
+        return jn -> !(jn.getJoinType() == JoinRelType.LEFT
+            || jn.getJoinType() == JoinRelType.LEFT_MARK
+            || isFullOrAntiJoin.test(jn));
       } else {
-        return jn -> !(jn.getJoinType() == JoinRelType.RIGHT  || isFullOrAntiJoin.test(jn));
+        return jn -> !(jn.getJoinType() == JoinRelType.RIGHT || isFullOrAntiJoin.test(jn));
       }
     }
 
diff --git a/core/src/test/resources/sql/new-decorr.iq b/core/src/test/resources/sql/new-decorr.iq
index 9257f05495..529bca6d1b 100644
--- a/core/src/test/resources/sql/new-decorr.iq
+++ b/core/src/test/resources/sql/new-decorr.iq
@@ -223,4 +223,16 @@ select * from dept where deptno not in (select deptno from emp where false);
 EnumerableValues(tuples=[[{ 10, 'Sales      ' }, { 20, 'Marketing  ' }, { 30, 'Engineering' }, { 40, 'Empty      ' }]])
 !plan
 
+# [CALCITE-7400] PruneJoinSingleValue rule causes type mismatch in IN
+# This case comes from sub-query.iq [CALCITE-4756]
+select 1 in (values(null), (null));
++--------+
+| EXPR$0 |
++--------+
+|        |
++--------+
+(1 row)
+
+!ok
+
 # End new-decorr.iq