-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-16672][SQL] SQLBuilder should not raise exceptions on EXISTS queries #14307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Test build #62689 has finished for PR 14307 at commit
|
|
Hi, @hvanhovell . |
|
I didn't even know such a SQL query is possible in SQL :) Lots to learn still. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LogicalPlanToSQLSuite?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see.
|
Test build #62756 has finished for PR 14307 at commit
|
|
Rebased. |
|
Hi, @hvanhovell . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: it is a little more readable if we move the addSubqueryIfNeeded(query) out of the if...else... and into a separate variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, right. I'll fix soon.
|
One minor comment. Looks pretty good. |
|
Thank you for review, @hvanhovell . |
|
LGMT, pending jenkins |
|
Test build #62815 has finished for PR 14307 at commit
|
|
It's strange . Jenkins does not trigger the test for the last commit. |
|
Oh, it became a maintenance mode. :( |
|
Test build #62820 has finished for PR 14307 at commit
|
|
Hi, @hvanhovell . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it'd be good to test the generated sql.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. No problem.
|
Hi, @rxin . |
|
Test build #62828 has finished for PR 14307 at commit
|
|
Merging in master/2.0. |
…ueries
## What changes were proposed in this pull request?
Currently, `SQLBuilder` raises `empty.reduceLeft` exceptions on *unoptimized* `EXISTS` queries. We had better prevent this.
```scala
scala> sql("CREATE TABLE t1(a int)")
scala> val df = sql("select * from t1 b where exists (select * from t1 a)")
scala> new org.apache.spark.sql.catalyst.SQLBuilder(df).toSQL
java.lang.UnsupportedOperationException: empty.reduceLeft
```
## How was this patch tested?
Pass the Jenkins tests with a new test suite.
Author: Dongjoon Hyun <dongjoon@apache.org>
Closes #14307 from dongjoon-hyun/SPARK-16672.
(cherry picked from commit 8a8d26f)
Signed-off-by: Reynold Xin <rxin@databricks.com>
|
Thank you so much for review and merging, @rxin , @hvanhovell , and @jaceklaskowski ! |
What changes were proposed in this pull request?
Currently,
SQLBuilderraisesempty.reduceLeftexceptions on unoptimizedEXISTSqueries. We had better prevent this.How was this patch tested?
Pass the Jenkins tests with a new test suite.