[
https://issues.apache.org/jira/browse/CALCITE-2986?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16818502#comment-16818502
]
Vineet Garg commented on CALCITE-2986:
--------------------------------------
[~hyuan] Let's say you have {code:sql}select col1, col2 <> ANY(select nullĀ from
table2) from table1{code}
This roughly will be rewritten into left semi join as {code} select col1, col2
from table1 left semi join left2 on col2<>null{code} . This will generate zero
result but we want {{col1, null}}
Does that make sense?
> 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)