Uh oh!
There was an error while loading. Please reload this page.
[SPARK-17251][SQL] Improve OuterReference to be NamedExpression - #16015
Closed
dongjoon-hyun wants to merge 2 commits into
Closed
[SPARK-17251][SQL] Improve OuterReference to be NamedExpression#16015dongjoon-hyun wants to merge 2 commits into
OuterReference to be NamedExpression#16015dongjoon-hyun wants to merge 2 commits into
Conversation
SparkQA
commented
Nov 26, 2016
Test build #69178 has finished for PR 16015 at commit
|
dongjoon-hyun
commented
Nov 26, 2016
MemberAuthor
The only one test failure is irrelevant to this PR. |
dongjoon-hyun
commented
Nov 26, 2016
MemberAuthor
Retest this please. |
SparkQA
commented
Nov 26, 2016
Test build #69181 has started for PR 16015 at commit |
dongjoon-hyun
commented
Nov 26, 2016
MemberAuthor
Unknown Jenkins failure. |
dongjoon-hyun
commented
Nov 26, 2016
MemberAuthor
Retest this please. |
SparkQA
commented
Nov 26, 2016
Test build #69182 has finished for PR 16015 at commit
|
| val m = intercept[AnalysisException] { | ||
| SimpleAnalyzer.ResolveSubquery(expr) | ||
| }.getMessage | ||
| assert(m.contains("Correlated predicates are not supported outside of WHERE/HAVING clauses")) |
Contributor
There was a problem hiding this comment.
Minor: Maybe we should update this error. Something like this: Expressions referencing the outer query are not supported outside of WHERE/HAVING clauses
hvanhovell
commented
Nov 26, 2016
Contributor
LGTM pending jenkins. |
dongjoon-hyun
commented
Nov 26, 2016
MemberAuthor
Thank you, @hvanhovell ! |
SparkQA
commented
Nov 26, 2016
Test build #69192 has finished for PR 16015 at commit
|
asfgit pushed a commit
that referenced
this pull request
Nov 26, 2016
## What changes were proposed in this pull request?
Currently, `OuterReference` is not `NamedExpression`. So, it raises 'ClassCastException` when it used in projection lists of IN correlated subqueries. This PR aims to support that by making `OuterReference` as `NamedExpression` to show correct error messages.
```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.
Author: Dongjoon Hyun <dongjoon@apache.org>
Closes#16015 from dongjoon-hyun/SPARK-17251-2.
(cherry picked from commit 9c03c56)
Signed-off-by: Herman van Hovell <hvanhovell@databricks.com>asfgit pushed a commit
that referenced
this pull request
Nov 26, 2016
## What changes were proposed in this pull request?
Currently, `OuterReference` is not `NamedExpression`. So, it raises 'ClassCastException` when it used in projection lists of IN correlated subqueries. This PR aims to support that by making `OuterReference` as `NamedExpression` to show correct error messages.
```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.
Author: Dongjoon Hyun <dongjoon@apache.org>
Closes#16015 from dongjoon-hyun/SPARK-17251-2.
(cherry picked from commit 9c03c56)
Signed-off-by: Herman van Hovell <hvanhovell@databricks.com>hvanhovell
commented
Nov 26, 2016
Contributor
Merging to master/2.1/2.0. Thanks! |
dongjoon-hyun
commented
Nov 26, 2016
MemberAuthor
Thank you for merging, @hvanhovell ! |
robert3005 pushed a commit
to palantir/spark
that referenced
this pull request
Dec 2, 2016
## What changes were proposed in this pull request?
Currently, `OuterReference` is not `NamedExpression`. So, it raises 'ClassCastException` when it used in projection lists of IN correlated subqueries. This PR aims to support that by making `OuterReference` as `NamedExpression` to show correct error messages.
```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.
Author: Dongjoon Hyun <dongjoon@apache.org>
Closesapache#16015 from dongjoon-hyun/SPARK-17251-2.uzadude pushed a commit
to uzadude/spark
that referenced
this pull request
Jan 27, 2017
## What changes were proposed in this pull request?
Currently, `OuterReference` is not `NamedExpression`. So, it raises 'ClassCastException` when it used in projection lists of IN correlated subqueries. This PR aims to support that by making `OuterReference` as `NamedExpression` to show correct error messages.
```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.
Author: Dongjoon Hyun <dongjoon@apache.org>
Closesapache#16015 from dongjoon-hyun/SPARK-17251-2.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Currently,
OuterReferenceis notNamedExpression. So, it raises 'ClassCastExceptionwhen it used in projection lists of IN correlated subqueries. This PR aims to support that by makingOuterReferenceasNamedExpression` to show correct error messages.How was this patch tested?
Pass the Jenkins test with new test cases.