You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Stamatis Zampetakis (Jira)" <ji...@apache.org> on 2023/04/26 09:53:00 UTC

[jira] [Resolved] (CALCITE-5675) Infer predicates for anti-join

     [ https://issues.apache.org/jira/browse/CALCITE-5675?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stamatis Zampetakis resolved CALCITE-5675.
------------------------------------------
    Fix Version/s: 1.35.0
       Resolution: Fixed

Fixed in [https://github.com/apache/calcite/commit/e5f7729d7d44630fc9c3b06bc326f335089b4b84.] Thanks for the review [~rubenql] !

> Infer predicates for anti-join
> ------------------------------
>
>                 Key: CALCITE-5675
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5675
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>            Reporter: Stamatis Zampetakis
>            Assignee: Stamatis Zampetakis
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.35.0
>
>
> Enhance {{RelMdPredicates}} to be able to infer predicates for anti-joins. 
> Consider the following plans with an anti join between EMP and DEPT tables.
> +PulledUpPredicates+
> {noformat}
> LogicalJoin(condition=[=($7, $8)], joinType=[anti])
>   LogicalFilter(condition=[=($1, 'Victor')])
>     LogicalTableScan(table=[[scott, EMP]])
>   LogicalFilter(condition=[=($1, 'CSD')])
>     LogicalTableScan(table=[[scott, DEPT]])
> {noformat}
> We can infer that the {{>($1, 'Victor')}} predicate holds on the result of the join.
> +RightInferredPredicates+
> {noformat}
> LogicalJoin(condition=[=($7, $8)], joinType=[anti])
>   LogicalFilter(condition=[>($7, 10)])
>     LogicalTableScan(table=[[scott, EMP]])
>   LogicalTableScan(table=[[scott, DEPT]])
> {noformat}
> We can infer that the {{>($0, 10)}} predicate holds on the right relation (DEPT).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)