You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by rxin <gi...@git.apache.org> on 2016/02/21 07:40:25 UTC

[GitHub] spark pull request: [SPARK-13306][SQL] Addendum to uncorrelated sc...

GitHub user rxin opened a pull request:

    https://github.com/apache/spark/pull/11285

    [SPARK-13306][SQL] Addendum to uncorrelated scalar subquery

    ## What changes were proposed in this pull request?
    This pull request fixes some minor issues (documentation, test flakiness) with #11190, which was merged earlier tonight.
    
    ## How was the this patch tested?
    unit tests.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/rxin/spark subquery

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/11285.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #11285
    
----
commit c9bd9878d1568ad6cd16966fdcf1cf54eb71f6fd
Author: Reynold Xin <rx...@databricks.com>
Date:   2016-02-21T06:38:53Z

    [SPARK-13306][SQL] Addendum to uncorrelated scalar subquery

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13306][SQL] Addendum to uncorrelated sc...

Posted by rxin <gi...@git.apache.org>.
Github user rxin commented on the pull request:

    https://github.com/apache/spark/pull/11285#issuecomment-186760939
  
    cc @davies 
    can you explain what the following test case is testing?
    
    ```
         assertResult(Array(Row(1))) {
           sql("with t2 as (select 1 as b, 2 as c) " +
             "select a from (select 1 as a union all select 2 as a) t " +
             "where a = (select max(b) from t2) ").collect()
         }
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13306][SQL] Addendum to uncorrelated sc...

Posted by rxin <gi...@git.apache.org>.
Github user rxin commented on the pull request:

    https://github.com/apache/spark/pull/11285#issuecomment-186760949
  
    Also explain why wholestagecodegen needs to call waitforsubqueries explicitly.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13306][SQL] Addendum to uncorrelated sc...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/11285#issuecomment-186789210
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13306][SQL] Addendum to uncorrelated sc...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/11285#issuecomment-186775454
  
    **[Test build #51614 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/51614/consoleFull)** for PR 11285 at commit [`de512f6`](https://github.com/apache/spark/commit/de512f6f154ed49897b64232f03d881f2daaccb0).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13306][SQL] Addendum to uncorrelated sc...

Posted by rxin <gi...@git.apache.org>.
Github user rxin commented on the pull request:

    https://github.com/apache/spark/pull/11285#issuecomment-186907761
  
    Merging this in master.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13306][SQL] Addendum to uncorrelated sc...

Posted by davies <gi...@git.apache.org>.
Github user davies commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11285#discussion_r53562501
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/SubquerySuite.scala ---
    @@ -36,36 +36,39 @@ class SubquerySuite extends QueryTest with SharedSQLContext {
           sql("select (select (select 1) + 1) + 1").collect()
         }
     
    -    // more than one columns
    -    val error = intercept[AnalysisException] {
    -      sql("select (select 1, 2) as b").collect()
    -    }
    -    assert(error.message contains "Scalar subquery must return only one column, but got 2")
    -
    -    // more than one rows
    -    val error2 = intercept[RuntimeException] {
    -      sql("select (select a from (select 1 as a union all select 2 as a) t) as b").collect()
    -    }
    -    assert(error2.getMessage contains
    -      "more than one row returned by a subquery used as an expression")
    -
         // string type
         assertResult(Array(Row("s"))) {
           sql("select (select 's' as s) as b").collect()
         }
    +  }
     
    -    // zero rows
    +  test("uncorrelated scalar subquery should return null if there is 0 rows") {
         assertResult(Array(Row(null))) {
           sql("select (select 's' as s limit 0) as b").collect()
         }
       }
     
    +  test("analysis error when the number of columns is not 1") {
    +    val error = intercept[AnalysisException] {
    +      sql("select (select 1, 2) as b").collect()
    +    }
    +    assert(error.message.contains("Scalar subquery must return only one column, but got 2"))
    --- End diff --
    
    These are already covered by AnasisErrorSuite, some one said that we don't need to cover every corner cases by end-to-end query tests.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13306][SQL] Addendum to uncorrelated sc...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/spark/pull/11285


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13306][SQL] Addendum to uncorrelated sc...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/11285#issuecomment-186789507
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13306][SQL] Addendum to uncorrelated sc...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/11285#issuecomment-186775782
  
    **[Test build #51611 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/51611/consoleFull)** for PR 11285 at commit [`c9bd987`](https://github.com/apache/spark/commit/c9bd9878d1568ad6cd16966fdcf1cf54eb71f6fd).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13306][SQL] Addendum to uncorrelated sc...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/11285#issuecomment-186789508
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/51611/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13306][SQL] Addendum to uncorrelated sc...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/11285#issuecomment-186789431
  
    **[Test build #51611 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/51611/consoleFull)** for PR 11285 at commit [`c9bd987`](https://github.com/apache/spark/commit/c9bd9878d1568ad6cd16966fdcf1cf54eb71f6fd).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds the following public classes _(experimental)_:
      * `case class PlanSubqueries(sqlContext: SQLContext) extends Rule[SparkPlan] `


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13306][SQL] Addendum to uncorrelated sc...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/11285#issuecomment-186789152
  
    **[Test build #51614 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/51614/consoleFull)** for PR 11285 at commit [`de512f6`](https://github.com/apache/spark/commit/de512f6f154ed49897b64232f03d881f2daaccb0).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13306][SQL] Addendum to uncorrelated sc...

Posted by rxin <gi...@git.apache.org>.
Github user rxin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11285#discussion_r53562458
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/literals.scala ---
    @@ -272,14 +272,3 @@ case class Literal protected (value: Any, dataType: DataType)
         case _ => value.toString
       }
     }
    -
    -// TODO: Specialize
    -case class MutableLiteral(var value: Any, dataType: DataType, nullable: Boolean = true)
    --- End diff --
    
    this was unused. just deleting it.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13306][SQL] Addendum to uncorrelated sc...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/11285#issuecomment-186789213
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/51614/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13306][SQL] Addendum to uncorrelated sc...

Posted by davies <gi...@git.apache.org>.
Github user davies commented on the pull request:

    https://github.com/apache/spark/pull/11285#issuecomment-186761382
  
    That case is used to test CTE and aggregation inside subquery.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-13306][SQL] Addendum to uncorrelated sc...

Posted by davies <gi...@git.apache.org>.
Github user davies commented on the pull request:

    https://github.com/apache/spark/pull/11285#issuecomment-186761357
  
    For those operators that is generated in WholeStageCodegen, the execute() of them are not called, but produce() will be called, we should make sure that all the subqueries all executed before generating the code in doProduce() and doConsume()


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org