You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Apache Spark (JIRA)" <ji...@apache.org> on 2016/08/09 09:02:20 UTC

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

    [ https://issues.apache.org/jira/browse/SPARK-16971?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15413236#comment-15413236 ] 

Apache Spark commented on SPARK-16971:
--------------------------------------

User 'HyukjinKwon' has created a pull request for this issue:
https://github.com/apache/spark/pull/14560

> Strip trailing zeros for decimals when using show() API in Dataset
> ------------------------------------------------------------------
>
>                 Key: SPARK-16971
>                 URL: https://issues.apache.org/jira/browse/SPARK-16971
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>            Reporter: Hyukjin Kwon
>
> Currently, `Dataset.show()` prints all the trailing zeros for decimals. For example,
> {code}
> spark.range(11).toDF("a").select('a.cast(DecimalType(30, 20))).show()
> {code}
> prints below:
> {code}
> +--------------------+
> |                   a|
> +--------------------+
> |               0E-20|
> |1.000000000000000...|
> |2.000000000000000...|
> |3.000000000000000...|
> |4.000000000000000...|
> |5.000000000000000...|
> |6.000000000000000...|
> |7.000000000000000...|
> |8.000000000000000...|
> |9.000000000000000...|
> |10.00000000000000...|
> +--------------------+
> {code}
> It might be confusing, in particualr, for {{0E-20}}. Also, I think we can strip the trailing zeros.
> So, the desired output might be as below:
> {code}
> +---+
> |  a|
> +---+
> |  0|
> |  1|
> |  2|
> |  3|
> |  4|
> |  5|
> |  6|
> |  7|
> |  8|
> |  9|
> | 10|
> +---+
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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