GitHub user HyukjinKwon opened a pull request:

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

    [SPARK-16971][SQL] Strip trailing zeros for decimals when using show() API 
in Dataset

    ## What changes were proposed in this pull request?
    
    Currently, `Dataset.show()` prints all the trailing zeros for decimals. For 
example,
    
    ```
    spark.range(11).toDF("a").select('a.cast(DecimalType(30, 20))).show()
    ```
    
    prints below:
    
    ```bash
    +--------------------+
    |                   a|
    +--------------------+
    |               0E-20|
    |1.000000000000000...|
    |2.000000000000000...|
    |3.000000000000000...|
    |4.000000000000000...|
    |5.000000000000000...|
    |6.000000000000000...|
    |7.000000000000000...|
    |8.000000000000000...|
    |9.000000000000000...|
    |10.00000000000000...|
    +--------------------+
    ```
    
    It might be confusing, in particular, for `0E-20`. Also, I think we can 
strip the trailing zeros.
    
    This PR fixes this as below:
    
    ```bash
    +---+
    |  a|
    +---+
    |  0|
    |  1|
    |  2|
    |  3|
    |  4|
    |  5|
    |  6|
    |  7|
    |  8|
    |  9|
    | 10|
    +---+
    ```
    
    ## How was this patch tested?
    
    Unit test in `DataFrameSuite`.


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

    $ git pull https://github.com/HyukjinKwon/spark SPARK-16971

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

    https://github.com/apache/spark/pull/14560.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 #14560
    
----
commit b8a5267d495f4a9bf882c82b730c660858e1eebf
Author: hyukjinkwon <gurwls...@gmail.com>
Date:   2016-08-09T08:58:13Z

    Strip trailing zeros for decimals when using show() API in Dataset

----


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