[
https://issues.apache.org/jira/browse/SPARK-18578?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Josh Rosen updated SPARK-18578:
-------------------------------
Labels: correctness (was: )
> Full outer join in correlated subquery returns incorrect results
> ----------------------------------------------------------------
>
> Key: SPARK-18578
> URL: https://issues.apache.org/jira/browse/SPARK-18578
> Project: Spark
> Issue Type: Bug
> Components: SQL
> Affects Versions: 2.0.0
> Reporter: Nattavut Sutyanyong
> Assignee: Nattavut Sutyanyong
> Priority: Major
> Labels: correctness
> Fix For: 2.1.0
>
>
> Full outer join with a correlated predicate in the left operand in a subquery
> may return incorrect results.
> Example:
> {code}
> Seq(1).toDF("c1").createOrReplaceTempView("t1")
> Seq(2).toDF("c1").createOrReplaceTempView("t2")
> Seq(1).toDF("c1").createOrReplaceTempView("t3")
> // Test case: 01 EXISTS subquery context
> // Expected result: 1 row
> // Actual result: 0 row
> sql("select * from t1 where exists (select 1 from (select c1 from t2 where
> t1.c1 = 2) t2 full join t3 on t2.c1=t3.c1)").show
> // Test case: 02 Scalar subquery context
> // Expected result: 1 row of value 1
> // Actual result: 1 row of NULL
> // Note adding the meaningless equi-join T1.c1=T2.c1 to get through the CROSS
> JOIN restriction
> sql("select (select max(1) from (select c1 from t2 where t1.c1 = 2 and
> t1.c1=t2.c1) t2 full join t3 on t2.c1=t3.c1) from t1").show
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]