You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by edrevo <gi...@git.apache.org> on 2014/06/25 15:32:20 UTC

[GitHub] spark pull request: SPARK-2186: Spark SQL DSL support for simple a...

GitHub user edrevo opened a pull request:

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

    SPARK-2186: Spark SQL DSL support for simple aggregations such as SUM and AVG

    **Description** This patch enables using the `.select()` function in SchemaRDD with functions such as `Sum`, `Count` and other.
    **Testing** Unit tests added.

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

    $ git pull https://github.com/edrevo/spark add-expression-support-in-select

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

    https://github.com/apache/spark/pull/1211.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 #1211
    
----
commit e1d344a18a92ca8dd05b094b5079fdca3b629551
Author: Ximo Guanter Gonzalbez <xi...@tid.es>
Date:   2014-06-25T13:09:35Z

    SPARK-2186: Spark SQL DSL support for simple aggregations such as SUM and AVG

----


---
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.
---

[GitHub] spark pull request: SPARK-2186: Spark SQL DSL support for simple a...

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

    https://github.com/apache/spark/pull/1211#issuecomment-47149603
  
    Yup, that's definitely doable. I'll work on adding that DSL support and add it to this pull request.


---
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.
---

[GitHub] spark pull request: SPARK-2186: Spark SQL DSL support for simple a...

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

    https://github.com/apache/spark/pull/1211#discussion_r14258072
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/dsl/package.scala ---
    @@ -108,6 +108,24 @@ package object dsl {
     
         implicit def symbolToUnresolvedAttribute(s: Symbol) = analysis.UnresolvedAttribute(s.name)
     
    +    def sum(e: Expression) = Sum(e)
    +    def sum(d: DistinctExpression) = SumDistinct(d.expression)
    --- End diff --
    
    What about `sumDistinct(e: Expression*)`?


---
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.
---

[GitHub] spark pull request: SPARK-2186: Spark SQL DSL support for simple a...

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

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


---
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.
---

[GitHub] spark pull request: SPARK-2186: Spark SQL DSL support for simple a...

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

    https://github.com/apache/spark/pull/1211#issuecomment-47146013
  
    All automated tests passed.
    Refer to this link for build results: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/16117/


---
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.
---

[GitHub] spark pull request: SPARK-2186: Spark SQL DSL support for simple a...

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

    https://github.com/apache/spark/pull/1211#issuecomment-47168498
  
    I thought about this more ('key.avg vs avg('key)), and IMHO the latter (avg('key)) is more natural. It matches nicely with what users write in SQL already. It also delivers the subtle message that 'key here is a cell (more precisely, the key attribute in each row) rather than a whole column. 
    
    



---
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.
---

[GitHub] spark pull request: SPARK-2186: Spark SQL DSL support for simple a...

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

    https://github.com/apache/spark/pull/1211#issuecomment-47101091
  
    Can one of the admins verify this patch?


---
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.
---

[GitHub] spark pull request: SPARK-2186: Spark SQL DSL support for simple a...

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

    https://github.com/apache/spark/pull/1211#issuecomment-57709568
  
      [QA tests have started](https://amplab.cs.berkeley.edu/jenkins/job/NewSparkPullRequestBuilder/258/consoleFull) for   PR 1211 at commit [`fe4a1e1`](https://github.com/apache/spark/commit/fe4a1e183d4e2a9f2ad2c3d9c9500eec6a407235).
     * This patch merges cleanly.


---
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-2186: Spark SQL DSL support for simple a...

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

    https://github.com/apache/spark/pull/1211#discussion_r14280656
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/dsl/package.scala ---
    @@ -108,6 +108,24 @@ package object dsl {
     
         implicit def symbolToUnresolvedAttribute(s: Symbol) = analysis.UnresolvedAttribute(s.name)
     
    +    def sum(e: Expression) = Sum(e)
    +    def sum(d: DistinctExpression) = SumDistinct(d.expression)
    --- End diff --
    
    There's no implicitness going on in here, since the user needs to explicitly call both `sum` and `disctinct`. I have no problem changing it, though.
    
    Fixed.


---
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.
---

[GitHub] spark pull request: SPARK-2186: Spark SQL DSL support for simple a...

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

    https://github.com/apache/spark/pull/1211#issuecomment-47146951
  
    Hi @edrevo -- thanks, the implementation looks really concise! I haven't thought about this, but what do people think about instead of having syntax like `AVG(key)`, we support something like `'key.avg`? One example in the current code base is `asc` (the sort order). Also +@marmbrus.


---
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.
---

[GitHub] spark pull request: SPARK-2186: Spark SQL DSL support for simple a...

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

    https://github.com/apache/spark/pull/1211#discussion_r14258173
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/dsl/package.scala ---
    @@ -108,6 +108,24 @@ package object dsl {
     
         implicit def symbolToUnresolvedAttribute(s: Symbol) = analysis.UnresolvedAttribute(s.name)
     
    +    def sum(e: Expression) = Sum(e)
    +    def sum(d: DistinctExpression) = SumDistinct(d.expression)
    --- End diff --
    
    You version is closer to SQL I guess, but I'm wary of too much implicit magic (there is already a lot!).


---
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.
---

[GitHub] spark pull request: SPARK-2186: Spark SQL DSL support for simple a...

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

    https://github.com/apache/spark/pull/1211#issuecomment-47805299
  
    No problem. Thanks for the update!


---
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.
---

[GitHub] spark pull request: SPARK-2186: Spark SQL DSL support for simple a...

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

    https://github.com/apache/spark/pull/1211#issuecomment-47146010
  
    Merged build finished. All automated tests 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.
---

[GitHub] spark pull request: SPARK-2186: Spark SQL DSL support for simple a...

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

    https://github.com/apache/spark/pull/1211#issuecomment-57721743
  
      [QA tests have finished](https://amplab.cs.berkeley.edu/jenkins/job/NewSparkPullRequestBuilder/258/consoleFull) for   PR 1211 at commit [`fe4a1e1`](https://github.com/apache/spark/commit/fe4a1e183d4e2a9f2ad2c3d9c9500eec6a407235).
     * This patch **fails** unit 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-2186: Spark SQL DSL support for simple a...

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

    https://github.com/apache/spark/pull/1211#issuecomment-47805797
  
    Thanks!  I've merged this into master and the 1.0 branches.


---
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.
---

[GitHub] spark pull request: SPARK-2186: Spark SQL DSL support for simple a...

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

    https://github.com/apache/spark/pull/1211#issuecomment-47805034
  
    Hi Ximo,
    
    Sorry for the delay. Many of the committers are busy running the Spark
    Summit these few days so a lot of PRs are backlog'd. They will probably be
    addressed later this week / early next week.
    
    
    
    On Wed, Jul 2, 2014 at 3:06 AM, Ximo Guanter <no...@github.com>
    wrote:
    
    > All feedback has been addressed
    >
    > —
    > Reply to this email directly or view it on GitHub
    > <https://github.com/apache/spark/pull/1211#issuecomment-47758337>.
    >


---
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.
---

[GitHub] spark pull request: SPARK-2186: Spark SQL DSL support for simple a...

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

    https://github.com/apache/spark/pull/1211#issuecomment-47134219
  
     Merged build triggered. 


---
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.
---

[GitHub] spark pull request: SPARK-2186: Spark SQL DSL support for simple a...

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

    https://github.com/apache/spark/pull/1211#issuecomment-47134060
  
    Jenkins, test this please.


---
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.
---

[GitHub] spark pull request: SPARK-2186: Spark SQL DSL support for simple a...

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

    https://github.com/apache/spark/pull/1211#issuecomment-47134233
  
    Merged build started. 


---
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.
---

[GitHub] spark pull request: SPARK-2186: Spark SQL DSL support for simple a...

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

    https://github.com/apache/spark/pull/1211#issuecomment-47191917
  
    I have added DSL support (`avg()`, `count(distinct())`...) following @rxin's suggestion. I'm happy to change the DSL style if you end up favoring the other approach.


---
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.
---

[GitHub] spark pull request: SPARK-2186: Spark SQL DSL support for simple a...

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

    https://github.com/apache/spark/pull/1211#issuecomment-47758337
  
    All feedback has been addressed


---
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.
---