GitHub user dongjoon-hyun opened a pull request:

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

    [SPARK-16429][SQL] Include `StringType` columns in Scala/Python `describe()`

    ## What changes were proposed in this pull request?
    
    Currently, Spark `describe` supports `StringType`. However, Scala/Python 
`describe()` returns a dataset for only all numeric columns. SparkR returns all 
columns. This PR include `StringType` columns in Scala/Python `describe()`, 
`describe` without argument.
    
    **Before**
    * Scala
     ```scala
    scala> 
spark.read.json("examples/src/main/resources/people.json").describe("age", 
"name").show()
    +-------+------------------+-------+
    |summary|               age|   name|
    +-------+------------------+-------+
    |  count|                 2|      3|
    |   mean|              24.5|   null|
    | stddev|7.7781745930520225|   null|
    |    min|                19|   Andy|
    |    max|                30|Michael|
    +-------+------------------+-------+
    scala> 
spark.read.json("examples/src/main/resources/people.json").describe().show()
    +-------+------------------+
    |summary|               age|
    +-------+------------------+
    |  count|                 2|
    |   mean|              24.5|
    | stddev|7.7781745930520225|
    |    min|                19|
    |    max|                30|
    +-------+------------------+
    ```
    
    * Python
     ```
    >>> 
spark.read.json("examples/src/main/resources/people.json").describe().show()
    +-------+------------------+
    |summary|               age|
    +-------+------------------+
    |  count|                 2|
    |   mean|              24.5|
    | stddev|7.7781745930520225|
    |    min|                19|
    |    max|                30|
    +-------+------------------+
    ```
    
    * R
     ```r
    > collect(describe(read.json("examples/src/main/resources/people.json")))
      summary                age    name
    1   count                  2       3
    2    mean               24.5    <NA>
    3  stddev 7.7781745930520225    <NA>
    4     min                 19    Andy
    5     max                 30 Michael
    ```
    
    **After**
    * Scala
     ```scala
    scala> 
spark.read.json("examples/src/main/resources/people.json").describe().show()
    +-------+------------------+-------+                                        
    
    |summary|               age|   name|
    +-------+------------------+-------+
    |  count|                 2|      3|
    |   mean|              24.5|   null|
    | stddev|7.7781745930520225|   null|
    |    min|                19|   Andy|
    |    max|                30|Michael|
    +-------+------------------+-------+
    ```
    
    * Python
     ```
    >>> 
spark.read.json("examples/src/main/resources/people.json").describe().show()
    +-------+------------------+-------+
    |summary|               age|   name|
    +-------+------------------+-------+
    |  count|                 2|      3|
    |   mean|              24.5|   null|
    | stddev|7.7781745930520225|   null|
    |    min|                19|   Andy|
    |    max|                30|Michael|
    +-------+------------------+-------+
    ```
    
    * R
    SparkR is the same.
    
    ## How was this patch tested?
    
    Pass the Jenkins with a update testcase.

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

    $ git pull https://github.com/dongjoon-hyun/spark SPARK-16429

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

    https://github.com/apache/spark/pull/14095.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 #14095
    
----
commit df2edd730216e659dbcebdcbda61dd67fbcf8d55
Author: Dongjoon Hyun <dongj...@apache.org>
Date:   2016-07-07T20:45:26Z

    [SPARK-16429][SQL] Include `StringType` columns in Scala/Python `describe()`

----


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to