[ 
https://issues.apache.org/jira/browse/CALCITE-2986?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16816817#comment-16816817
 ] 

Danny Chan commented on CALCITE-2986:
-------------------------------------

>  IN corresponds to = and is rewritten using LEFT OUTER JOIN

It's not true that IN will be rewritten to LEFT join, actually it will rewrite 
to a INNER join[1], the left is a table san and the right is an agg.

For <> ANY, i think it can also be interpreted as a NestedLoopJoin(physical) 
and INNER join for logical.

 

[1] 
https://github.com/apache/calcite/blob/38e3c3015b661f8f9dc61d8d0ef4be6186a4bc7a/core/src/main/java/org/apache/calcite/rel/rules/SubQueryRemoveRule.java#L410

> Wrong results with =ANY subquery
> --------------------------------
>
>                 Key: CALCITE-2986
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2986
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Vineet Garg
>            Assignee: Vineet Garg
>            Priority: Major
>              Labels: pull-request-available, sub-query
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> ANY/SOME subqueries are rewritten using MAX/MIN and cross-join. This is wrong 
> transformation for {{=ANY}} and {{<>ANY}} (and therefore {{=ALL}} and 
> {{<>ALL}}).
> Query
> {code:sql}
> select * from "scott".emp where empno = any (select empno from "scott".emp);
> {code}
> Expected output for above query is all rows from {{scott.emp}} but actual is 
> only one row
> Test case: e.g. 
> https://github.com/apache/calcite/compare/master...vineetgarg02:CALCITE-2986



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to