[
https://issues.apache.org/jira/browse/CALCITE-6948?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17944270#comment-17944270
]
Julian Hyde edited comment on CALCITE-6948 at 4/14/25 7:49 AM:
---------------------------------------------------------------
[~jensen], [~mbudiu], In my above comment I was asking for changes to the
documentation of the rule, changes to the summary, and changes to the commit
message. None of these occurred, yet the commit was still merged. What happened?
{quote}rules can be repeated conversion plan to achieve multiple\{quote}
That's not true. The rule as written will only match a 2-way Minus, and will
ignore 3-way Minus etc.
was (Author: julianhyde):
[~jensen], [~mbudiu], In my above comment I was asking for changes to the
documentation of the rule, changes to the summary, and changes to the commit
message. None of these occurred, yet the commit was still merged. What happened?
> Implement MinusToAntiJoinRule
> -----------------------------
>
> Key: CALCITE-6948
> URL: https://issues.apache.org/jira/browse/CALCITE-6948
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Affects Versions: 1.39.0
> Reporter: Zhen Chen
> Assignee: Zhen Chen
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.40.0
>
>
> Similar to IntersectToSemiJoinRule, we can implement MinusToAntiJoinRule.
> Like this:
> from:
> {code:java}
> LogicalMinus(all=[false])
> LogicalProject(ENAME=[$1])
> LogicalFilter(condition=[=($7, 10)])
> LogicalTableScan(table=[[CATALOG, SALES, EMP]])
> LogicalProject(ENAME=[$1])
> LogicalFilter(condition=[=($7, 20)])
> LogicalTableScan(table=[[CATALOG, SALES, EMP]]) {code}
> to:
> {code:java}
> LogicalAggregate(group=[{0}])
> LogicalJoin(condition=[IS NOT DISTINCT FROM($0, $1)], joinType=[anti])
> LogicalProject(ENAME=[$1])
> LogicalFilter(condition=[=($7, 10)])
> LogicalTableScan(table=[[CATALOG, SALES, EMP]])
> LogicalProject(ENAME=[$1])
> LogicalFilter(condition=[=($7, 20)])
> LogicalTableScan(table=[[CATALOG, SALES, EMP]]) {code}
> SQL like:
> from
>
> {code:java}
> select empid from emps
> except
> select empid from emps where empid > 150;{code}
> to
>
> {code:java}
> SELECT empid
> FROM emps A
> WHERE NOT EXISTS (
> SELECT 1
> FROM emps B
> WHERE B.empid > 150 and A.empid is not distinct from B.empid
> ); {code}
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)