aboutsummaryrefslogtreecommitdiff
path: root/sql/core/src/test/scala
diff options
context:
space:
mode:
authorNattavut Sutyanyong <nsy.can@gmail.com>2017-03-14 10:37:10 +0100
committerHerman van Hovell <hvanhovell@databricks.com>2017-03-14 10:37:10 +0100
commit4ce970d71488c7de6025ef925f75b8b92a5a6a79 (patch)
tree2857e3a5c373359042796ca662769b786bc83fbf /sql/core/src/test/scala
parentf6314eab4b494bd5b5e9e41c6f582d4f22c0967a (diff)
downloadspark-4ce970d71488c7de6025ef925f75b8b92a5a6a79.tar.gz
spark-4ce970d71488c7de6025ef925f75b8b92a5a6a79.tar.bz2
spark-4ce970d71488c7de6025ef925f75b8b92a5a6a79.zip
[SPARK-18874][SQL] First phase: Deferring the correlated predicate pull 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](https://github.com/apache/spark/pull/16337) [16759](https://github.com/apache/spark/pull/16759) [16841](https://github.com/apache/spark/pull/16841) [16915](https://github.com/apache/spark/pull/16915) [16798](https://github.com/apache/spark/pull/16798) [16712](https://github.com/apache/spark/pull/16712) [16710](https://github.com/apache/spark/pull/16710) [16760](https://github.com/apache/spark/pull/16760) [16802](https://github.com/apache/spark/pull/16802) Author: Dilip Biswal <dbiswal@us.ibm.com> Closes #16954 from dilipbiswal/SPARK-18874.
Diffstat (limited to 'sql/core/src/test/scala')
-rw-r--r--sql/core/src/test/scala/org/apache/spark/sql/SubquerySuite.scala7
1 files changed, 6 insertions, 1 deletions
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/SubquerySuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/SubquerySuite.scala
index 25dbecb589..6f1cd49c08 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/SubquerySuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/SubquerySuite.scala
@@ -622,7 +622,12 @@ class SubquerySuite extends QueryTest with SharedSQLContext {
test("SPARK-15370: COUNT bug with attribute ref in subquery input and output ") {
checkAnswer(
- sql("select l.b, (select (r.c + count(*)) is null from r where l.a = r.c) from l"),
+ sql(
+ """
+ |select l.b, (select (r.c + count(*)) is null
+ |from r
+ |where l.a = r.c group by r.c) from l
+ """.stripMargin),
Row(1.0, false) :: Row(1.0, false) :: Row(2.0, true) :: Row(2.0, true) ::
Row(3.0, false) :: Row(5.0, true) :: Row(null, false) :: Row(null, true) :: Nil)
}