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

asolimando 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 f1122459e3 [CALCITE-7907] Extend UnionToDistinctRule to match Union 
instead of LogicalUnion
f1122459e3 is described below

commit f1122459e37a304210a42302dac0c8558e33f190
Author: Alessandro Solimando <[email protected]>
AuthorDate: Fri Oct 30 10:32:51 2026 +0100

    [CALCITE-7907] Extend UnionToDistinctRule to match Union instead of 
LogicalUnion
    
    Widen the default operand of CoreRules.UNION_TO_DISTINCT from LogicalUnion
    to Union so the rule fires on any Union subclass. Downstream users can
    still bind a narrower subclass via Config.withOperandFor(Class).
---
 .../java/org/apache/calcite/rel/rules/UnionToDistinctRule.java     | 5 +++--
 site/_docs/history.md                                              | 7 +++++++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git 
a/core/src/main/java/org/apache/calcite/rel/rules/UnionToDistinctRule.java 
b/core/src/main/java/org/apache/calcite/rel/rules/UnionToDistinctRule.java
index c47a6529db..0990c4b296 100644
--- a/core/src/main/java/org/apache/calcite/rel/rules/UnionToDistinctRule.java
+++ b/core/src/main/java/org/apache/calcite/rel/rules/UnionToDistinctRule.java
@@ -20,7 +20,6 @@
 import org.apache.calcite.plan.RelRule;
 import org.apache.calcite.rel.core.RelFactories;
 import org.apache.calcite.rel.core.Union;
-import org.apache.calcite.rel.logical.LogicalUnion;
 import org.apache.calcite.tools.RelBuilder;
 import org.apache.calcite.tools.RelBuilderFactory;
 
@@ -76,8 +75,10 @@ public UnionToDistinctRule(Class<? extends Union> unionClazz,
   /** Rule configuration. */
   @Value.Immutable
   public interface Config extends RelRule.Config {
+    /** Default configuration: matches any {@link Union} with {@code all = 
false};
+     * use {@link #withOperandFor(Class)} to narrow. */
     Config DEFAULT = ImmutableUnionToDistinctRule.Config.of()
-        .withOperandFor(LogicalUnion.class);
+        .withOperandFor(Union.class);
 
     @Override default UnionToDistinctRule toRule() {
       return new UnionToDistinctRule(this);
diff --git a/site/_docs/history.md b/site/_docs/history.md
index 1fea0c9f1f..0eb0fe88c3 100644
--- a/site/_docs/history.md
+++ b/site/_docs/history.md
@@ -49,6 +49,13 @@ ## <a 
href="https://github.com/apache/calcite/releases/tag/calcite-1.43.0";>1.43.
 #### Breaking Changes
 {: #breaking-1-43-0}
 
+* [<a 
href="https://issues.apache.org/jira/browse/CALCITE-7907";>CALCITE-7907</a>]
+  Extend `UnionToDistinctRule` to match `Union` instead of `LogicalUnion`.
+  The default configuration of `UnionToDistinctRule` 
(`CoreRules.UNION_TO_DISTINCT`)
+  has changed: the rule's matching scope has increased. Projects that need the
+  previous behavior can use
+  `UnionToDistinctRule.Config.DEFAULT.withOperandFor(LogicalUnion.class)`.
+
 * [<a 
href="https://issues.apache.org/jira/browse/CALCITE-7580";>CALCITE-7580</a>]
   Remove Gandiva dependency from Arrow adapter. Arrow adapter projection and
   filter evaluation now run in Java, and the `arrow-gandiva` dependency is no

Reply via email to