-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-18872][SQL][TESTS] New test cases for EXISTS subquery #16710
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
| emp 2 100.0 | ||
| emp 2 300.0 | ||
| emp 3 300.0 | ||
| emp 4 100.0 |
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.
I have compared this result file with the attached DB2 output. The two sets of result are equivalent.
| emp 1 10.0 | ||
| emp 1 20.0 | ||
| emp 2 100.0 | ||
| emp 4 100.0 |
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.
I have compared this result file with the attached DB2 output. The two sets of result are equivalent.
|
Test build #72029 has finished for PR 16710 at commit
|
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.
I did the compare. The results are consistent with the output of DB2.
|
LGTM |
|
Could you update the PR descriptions? Currently, it does not correctly describe the cases you added. |
| WHERE NOT EXISTS (SELECT * | ||
| FROM emp | ||
| WHERE emp.emp_name = emp_name | ||
| AND bonus_amt > emp.salary); |
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.
Could you also add one more test case, which is very like TC.01.08? This test case is used very often in the real world. BTW, you do not need to run DB2. We can know the results using our naked eyes. : )
-- select values present in one table but missing in another one
SELECT emp.*
FROM emp
WHERE NOT EXISTS (SELECT NULL
FROM bonus
WHERE bonus.emp_name = emp.emp_name);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.
@gatorsmile Thanks .. I have added the suggested test case and have updated the PR description.
|
Test build #72121 has started for PR 16710 at commit |
|
retest this please |
|
Test build #72125 has finished for PR 16710 at commit
|
|
Thanks! Merging to master. |
|
Thank you very much @gatorsmile |
## What changes were proposed in this pull request? This PR adds the first set of tests for EXISTS subquery. File name | Brief description ------------------------| ----------------- exists-basic.sql |Tests EXISTS and NOT EXISTS subqueries with both correlated and local predicates. exists-within-and-or.sql|Tests EXISTS and NOT EXISTS subqueries embedded in AND or OR expression. DB2 results are attached here as reference : [exists-basic-db2.txt](https://github.com/apache/spark/files/733031/exists-basic-db2.txt) [exists-and-or-db2.txt](https://github.com/apache/spark/files/733030/exists-and-or-db2.txt) ## How was this patch tested? This patch is adding tests. Author: Dilip Biswal <[email protected]> Closes apache#16710 from dilipbiswal/exist-basic.
…ll up to Optimizer phase ## What changes were proposed in this pull request? Currently Analyzer as part of ResolveSubquery, pulls up the correlated predicates to its originating SubqueryExpression. The subquery plan is then transformed to remove the correlated predicates after they are moved up to the outer plan. In this PR, the task of pulling up correlated predicates is deferred to Optimizer. This is the initial work that will allow us to support the form of correlated subqueries that we don't support today. The design document from nsyca can be found in the following link : [DesignDoc](https://docs.google.com/document/d/1QDZ8JwU63RwGFS6KVF54Rjj9ZJyK33d49ZWbjFBaIgU/edit#) The brief description of code changes (hopefully to aid with code review) can be be found in the following link: [CodeChanges](https://docs.google.com/document/d/18mqjhL9V1An-tNta7aVE13HkALRZ5GZ24AATA-Vqqf0/edit#) ## How was this patch tested? The test case PRs were submitted earlier using. [16337](#16337) [16759](#16759) [16841](#16841) [16915](#16915) [16798](#16798) [16712](#16712) [16710](#16710) [16760](#16760) [16802](#16802) Author: Dilip Biswal <[email protected]> Closes #16954 from dilipbiswal/SPARK-18874.
What changes were proposed in this pull request?
This PR adds the first set of tests for EXISTS subquery.
DB2 results are attached here as reference :
exists-basic-db2.txt
exists-and-or-db2.txt
How was this patch tested?
This patch is adding tests.