[
https://issues.apache.org/jira/browse/CALCITE-6836?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17937668#comment-17937668
]
xiong duan commented on CALCITE-6836:
-------------------------------------
Fixed in
[847b1e8|https://github.com/apache/calcite/commit/847b1e8f9f55b025be810628665af05a71e2d8a9].
Thanks for the review [~mbudiu] , [~suibianwanwan33] and [~asolimando]. Thanks
for the contribution [~jensen] .
> Add Rule to convert INTERSECT to EXISTS
> ---------------------------------------
>
> Key: CALCITE-6836
> URL: https://issues.apache.org/jira/browse/CALCITE-6836
> Project: Calcite
> Issue Type: Bug
> Reporter: xiong duan
> Assignee: Zhen Chen
> Priority: Major
> Labels: pull-request-available
>
> The INTERSECT SQL:
> {code:java}
> SELECT a.CustID FROM tbl1 AS a
> INTERSECT
> SELECT b.CustID FROM tbl2 AS b {code}
> The converted Exists SQL:
> {code:java}
> SELECT DISTINCT a.CustID FROM tbl1 AS a
> WHERE EXISTS (SELECT b.CustID FROM tbl2 b WHERE (a.CustID=b.CustID)) {code}
> This optimized method is also described in the paper(The eighth rule in
> Chapter Three) [Extensible/rule based query rewrite optimization in
> Starburst|https://15799.courses.cs.cmu.edu/spring2025/papers/03-starburst/pirahesh-sigmodrec1992.pdf].
--
This message was sent by Atlassian Jira
(v8.20.10#820010)