Allison Wang created SPARK-36115:
------------------------------------
Summary: Handle the COUNT bug for correlated IN/EXISTS subquery
Key: SPARK-36115
URL: https://issues.apache.org/jira/browse/SPARK-36115
Project: Spark
Issue Type: Sub-task
Components: SQL
Affects Versions: 3.2.0
Reporter: Allison Wang
Correlated IN/EXISTS subqueries are also subject to the COUNT bug which is not
handled.
{code:sql}
create view t1(c1, c2) as values (0, 1), (1, 2)
create view t2(c1, c2) as values (0, 2), (0, 3)
-- Example 1: IN subquery
select * from t1 where c1 in (select count(*) + 1 from t2 where t1.c1 = t2.c1)
-- Correct answer: (1, 2)
+---+---+
|c1 |c2 |
+---+---+
+---+---+
-- Example 2: EXISTS subquery
select * from t1 where exists (select count(*) from t2 where t1.c1 = t2.c1)
-- Correct answer: [(0, 1), (1, 2)]
+---+---+
|c1 |c2 |
+---+---+
|0 |1 |
+---+---+
{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]