Skip to content
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

[SPARK-18872][SQL][TESTS] New test cases for EXISTS subquery (Joins + CTE) #16802

Closed
wants to merge 2 commits into from

Conversation

dilipbiswal
Copy link
Contributor

@dilipbiswal dilipbiswal commented Feb 4, 2017

What changes were proposed in this pull request?

This PR adds the third and final set of tests for EXISTS subquery.

File name Brief description
exists-cte.sql Tests Exist subqueries referencing CTE
exists-joins-and-set-ops.sql Tests Exists subquery used in Joins (Both when joins occurs in outer and suquery blocks)

DB2 results are attached here as reference :

exists-cte-db2.txt
exists-joins-and-set-ops-db2.txt (updated)

How was this patch tested?

The test result is compared with the result run from another SQL engine (in this case is IBM DB2). If the result are equivalent, we assume the result is correct.

@SparkQA
Copy link

SparkQA commented Feb 4, 2017

Test build #72363 has started for PR 16802 at commit 6794681.

@hvanhovell
Copy link
Contributor

Retest this please

@SparkQA
Copy link

SparkQA commented Feb 4, 2017

Test build #72367 has finished for PR 16802 at commit 6794681.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

emp 3 300.0
emp 4 100.0
emp 5 1000.0
emp 6 - no dept 500.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have verified the answer sets in this file match with the ones in DB2.

500 emp 5 2001-01-01 400.0 NULL
600 emp 6 - no dept 2001-01-01 400.0 100
700 emp 7 2010-01-01 400.0 100
800 emp 8 2016-01-01 150.0 70
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have verified the answer sets in this file match with the ones in DB2.

FROM dept
WHERE dept_id >= 30
AND dept_id <= 50);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, @dilipbiswal .
Can we have another test case, TC.02.05, here for UNION instead of UNION ALL?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dongjoon-hyun Thanks !! I have added the UNION test case. I have also uploaded the updated db2 result file.

@SparkQA
Copy link

SparkQA commented Feb 5, 2017

Test build #72415 has finished for PR 16802 at commit 3ebd654.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@dilipbiswal
Copy link
Contributor Author

cc @hvanhovell @gatorsmile
Thanks @nsyca @dongjoon-hyun for reviewing.

@hvanhovell
Copy link
Contributor

LGTM - merging to master.

@asfgit asfgit closed this in a8a1398 Feb 15, 2017
@dilipbiswal
Copy link
Contributor Author

@hvanhovell Thank you very much Herman !!

cmonkey pushed a commit to cmonkey/spark that referenced this pull request Feb 16, 2017
… CTE)

## What changes were proposed in this pull request?

This PR adds the third and final set of tests for EXISTS subquery.

File name                        | Brief description
------------------------| -----------------
exists-cte.sql              |Tests Exist subqueries referencing CTE
exists-joins-and-set-ops.sql|Tests Exists subquery used in Joins (Both when joins occurs in outer and suquery blocks)

DB2 results are attached here as reference :

[exists-cte-db2.txt](https://github.com/apache/spark/files/752091/exists-cte-db2.txt)
[exists-joins-and-set-ops-db2.txt](https://github.com/apache/spark/files/753283/exists-joins-and-set-ops-db2.txt) (updated)

## How was this patch tested?
The test result is compared with the result run from another SQL engine (in this case is IBM DB2). If the result are equivalent, we assume the result is correct.

Author: Dilip Biswal <dbiswal@us.ibm.com>

Closes apache#16802 from dilipbiswal/exists-pr3.
asfgit pushed a commit that referenced this pull request Mar 14, 2017
…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 <dbiswal@us.ibm.com>

Closes #16954 from dilipbiswal/SPARK-18874.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants