Skip to content

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

Closed
dilipbiswal wants to merge 2 commits into
apache:masterfrom
dilipbiswal:exists-pr3
Closed

[SPARK-18872][SQL][TESTS] New test cases for EXISTS subquery (Joins + CTE)#16802
dilipbiswal wants to merge 2 commits into
apache:masterfrom
dilipbiswal:exists-pr3

Conversation

@dilipbiswal

@dilipbiswaldilipbiswal commented Feb 4, 2017

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

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

File nameBrief description
exists-cte.sqlTests Exist subqueries referencing CTE
exists-joins-and-set-ops.sqlTests 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
Copy Markdown

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

@hvanhovell

Copy link
Copy Markdown
Contributor

Retest this please

@SparkQA

Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
ContributorAuthor

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
Copy Markdown

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
Copy Markdown
ContributorAuthor

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

@hvanhovell

Copy link
Copy Markdown
Contributor

LGTM - merging to master.

@dilipbiswal

Copy link
Copy Markdown
ContributorAuthor

@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>
Closesapache#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 freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@dilipbiswal@SparkQA@hvanhovell@dongjoon-hyun@nsyca