You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by mortada <gi...@git.apache.org> on 2016/06/10 02:41:58 UTC

[GitHub] spark pull request #13587: [Documentation] fixed groupby aggregation example...

GitHub user mortada opened a pull request:

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

    [Documentation] fixed groupby aggregation example for pyspark

    ## What changes were proposed in this pull request?
    
    fixing documentation for the groupby/agg example in python
    
    ## How was this patch tested?
    
    the existing example in the documentation dose not contain valid syntax (missing parenthesis) and is not using `Column` in the expression for `agg()`
    
    after the fix here's how I tested it:
    
    ```
    In [1]: from pyspark.sql import Row
    
    In [2]: import pyspark.sql.functions as func
    
    In [3]: %cpaste
    Pasting code; enter '--' alone on the line to stop or use Ctrl-D.
    :records = [{'age': 19, 'department': 1, 'expense': 100},
    : {'age': 20, 'department': 1, 'expense': 200},
    : {'age': 21, 'department': 2, 'expense': 300},
    : {'age': 22, 'department': 2, 'expense': 300},
    : {'age': 23, 'department': 3, 'expense': 300}]
    :--
    
    In [4]: df = sqlContext.createDataFrame([Row(**d) for d in records])
    
    In [5]: df.groupBy("department").agg(df["department"], func.max("age"), func.sum("expense")).show()
    
    +----------+----------+--------+------------+
    |department|department|max(age)|sum(expense)|
    +----------+----------+--------+------------+
    |         1|         1|      20|         300|
    |         2|         2|      22|         600|
    |         3|         3|      23|         300|
    +----------+----------+--------+------------+


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

    $ git pull https://github.com/mortada/spark groupby_agg_doc_fix

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

    https://github.com/apache/spark/pull/13587.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 #13587
    
----
commit 783415c9424cb6db1333aa5bc3ccd3cd1b227204
Author: Mortada Mehyar <mo...@gmail.com>
Date:   2016-06-10T02:34:16Z

    [Documentation] fixed groupby aggregation example for pyspark

----


---
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 issue #13587: [Documentation] fixed groupby aggregation example for py...

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

    https://github.com/apache/spark/pull/13587
  
    Thanks - merging in master/2.0/1.6.



---
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 #13587: [Documentation] fixed groupby aggregation example...

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

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


---
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 issue #13587: [Documentation] fixed groupby aggregation example for py...

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

    https://github.com/apache/spark/pull/13587
  
    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.
---

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