GitHub user dongjoon-hyun opened a pull request:
https://github.com/apache/spark/pull/16012
[SPARK-17251][SQL] Support `OuterReference` in projection list of a
correlated subquery
## What changes were proposed in this pull request?
Currently, correlated subqueries does not allow `OuterReference` columns in
projection lists. This PR aims to support that by making `OuterReference` as
`NamedExpression` and extending `pullOutCorrelatedPredicates` into
`pullOutCorrelatedProjectionAndPredicates`.
```scala
scala> sql("CREATE TEMPORARY VIEW t1 AS SELECT * FROM VALUES 1, 2 AS t1(a)")
scala> sql("CREATE TEMPORARY VIEW t2 AS SELECT * FROM VALUES 1 AS t2(b)")
scala> sql("SELECT a FROM t1 WHERE a IN (SELECT a FROM t2)").show
java.lang.ClassCastException:
org.apache.spark.sql.catalyst.expressions.OuterReference cannot be cast to
org.apache.spark.sql.catalyst.expressions.NamedExpression
```
## How was this patch tested?
Pass the Jenkins test with new test cases.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/dongjoon-hyun/spark SPARK-17251
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/16012.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #16012
----
commit 58449b317f9a04e5cba2f106afede19dbfde953e
Author: Dongjoon Hyun <[email protected]>
Date: 2016-11-24T22:15:04Z
[SPARK-17251][SQL] Support `OuterReference` in projection list of a
correlated subquery
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]