Alessandro Solimando created CALCITE-7907:
---------------------------------------------

             Summary: Extend UnionToDistinctRule to match Union instead of 
LogicalUnion
                 Key: CALCITE-7907
                 URL: https://issues.apache.org/jira/browse/CALCITE-7907
             Project: Calcite
          Issue Type: Improvement
          Components: core
    Affects Versions: 1.42.0
            Reporter: Alessandro Solimando
            Assignee: Alessandro Solimando
             Fix For: 1.43.0


_UnionToDistinctRule.Config.DEFAULT_ binds its operand to _LogicalUnion_ 
([here|https://github.com/apache/calcite/blob/71739891623e613f64898caabb50665ecdda33f2/core/src/main/java/org/apache/calcite/rel/rules/UnionToDistinctRule.java#L79-L80]),
 so _CoreRules.UNION_TO_DISTINCT_ does not fire on other _Union_ subclasses, 
and engines with their own logical _Union_ that reuse Calcite's default rule 
lists have to re-instantiate it.

The sibling set-operation rules already match the core classes: 
 * {_}UnionPullUpConstantsRule{_},
 * _UnionToValuesRule_ (next to this rule in 
{_}RelOptRules.ABSTRACT_RELATIONAL_RULES{_}),
 * {_}SetOpToFilterRule{_},
 * _PruneEmptyRules_ (CALCITE-5293),
 * _JoinUnionTransposeRule_ (CALCITE-1129, the same change on the same 
operator),
 * _ProjectSetOpTransposeRule_ (CALCITE-6495).

This is a (small) breaking change, the default matching scope increases: it 
will be listed in the Breaking Changes section of history.md, and the previous 
behavior remains available via 
{_}UnionToDistinctRule.Config.DEFAULT.withOperandFor(LogicalUnion.class){_}.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to