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 2f2ae4681f [CALCITE-7429] Query with MINUS fails with "Unable to 
implement EnumerableMinus(all=[false])"
2f2ae4681f is described below

commit 2f2ae4681f1eab3147a432d5c84671f45ea9e18c
Author: Zhen Chen <[email protected]>
AuthorDate: Wed Mar 4 22:38:38 2026 +0800

    [CALCITE-7429] Query with MINUS fails with "Unable to implement 
EnumerableMinus(all=[false])"
---
 .../adapter/enumerable/EnumerableIntersect.java    |  4 ---
 .../adapter/enumerable/EnumerableMinus.java        |  4 ---
 core/src/test/resources/sql/set-op.iq              | 31 ++++++++++++++++++++++
 3 files changed, 31 insertions(+), 8 deletions(-)

diff --git 
a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableIntersect.java
 
b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableIntersect.java
index e20a8ad765..01f9ab0206 100644
--- 
a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableIntersect.java
+++ 
b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableIntersect.java
@@ -64,10 +64,6 @@ public EnumerableIntersect(RelOptCluster cluster, 
RelTraitSet traitSet,
                     .appendIfNotNull(result.physType.comparer())
                     .append(Expressions.constant(all)));
       }
-
-      // Once the first input has chosen its format, ask for the same for
-      // other inputs.
-      pref = pref.of(result.format);
     }
 
     builder.add(requireNonNull(intersectExp, "intersectExp"));
diff --git 
a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableMinus.java 
b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableMinus.java
index 33952937d1..fcb17cde74 100644
--- 
a/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableMinus.java
+++ 
b/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableMinus.java
@@ -65,10 +65,6 @@ public EnumerableMinus(RelOptCluster cluster, RelTraitSet 
traitSet,
                     .appendIfNotNull(result.physType.comparer())
                     .append(Expressions.constant(all)));
       }
-
-      // Once the first input has chosen its format, ask for the same for
-      // other inputs.
-      pref = pref.of(result.format);
     }
 
     builder.add(
diff --git a/core/src/test/resources/sql/set-op.iq 
b/core/src/test/resources/sql/set-op.iq
index 4b3917ad30..1564650b1f 100644
--- a/core/src/test/resources/sql/set-op.iq
+++ b/core/src/test/resources/sql/set-op.iq
@@ -295,4 +295,35 @@ EnumerableCalc(expr#0=[{inputs}], expr#1=[3], 
proj#0..1=[{exprs}])
     EnumerableValues(tuples=[[{ 30, 3 }, { 30, 3 }]])
 !plan
 
+# [CALCITE-7429] Query with MINUS fails with "Unable to implement 
EnumerableMinus(all=[false])"
+!use scott
+SELECT deptno FROM dept WHERE deptno > 12
+EXCEPT
+SELECT deptno FROM emp e1 WHERE EXISTS (
+    SELECT 1 FROM emp e2
+    WHERE e2.comm = e1.comm);
++--------+
+| DEPTNO |
++--------+
+|     20 |
+|     40 |
++--------+
+(2 rows)
+
+!ok
+
+SELECT deptno FROM dept WHERE deptno > 12
+INTERSECT
+SELECT deptno FROM emp e1 WHERE EXISTS (
+    SELECT 1 FROM emp e2
+    WHERE e2.comm = e1.comm);
++--------+
+| DEPTNO |
++--------+
+|     30 |
++--------+
+(1 row)
+
+!ok
+
 # End set-op.iq

Reply via email to