You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "xiong duan (Jira)" <ji...@apache.org> on 2022/04/27 01:38:00 UTC

[jira] [Updated] (CALCITE-5117) Optimize the EXISTS sub-query by Metadata RowCount

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

xiong duan updated CALCITE-5117:
--------------------------------
    Labels: pull-request-available  (was: )

> Optimize the EXISTS sub-query by Metadata RowCount
> --------------------------------------------------
>
>                 Key: CALCITE-5117
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5117
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.30.0
>            Reporter: xiong duan
>            Assignee: xiong duan
>            Priority: Major
>              Labels: pull-request-available
>
> As same as the UNIQUE sub-query, before we convert the sub-query to RelNode. we use the Metadata to optimize it.
> EXISTS sub-query, If the sub-query is guaranteed to produce at least one row, just return TRUE. If the sub-query is guaranteed to produce no row, just return FALSE.
> For example:
> {code:java}
> select *
> from dept as d
> where EXISTS (select count(*) from emp e where d.deptno = e.deptno){code}
> We can optimize it to:
> {code:java}
> EnumerableTableScan(table=[[scott, DEPT]]){code}



--
This message was sent by Atlassian Jira
(v8.20.7#820007)