You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Marco Gaido (JIRA)" <ji...@apache.org> on 2018/06/20 13:26:00 UTC
[jira] [Resolved] (SPARK-24606) Decimals multiplication and
division may be null due to the result precision overflow
[ https://issues.apache.org/jira/browse/SPARK-24606?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Marco Gaido resolved SPARK-24606.
---------------------------------
Resolution: Duplicate
> Decimals multiplication and division may be null due to the result precision overflow
> -------------------------------------------------------------------------------------
>
> Key: SPARK-24606
> URL: https://issues.apache.org/jira/browse/SPARK-24606
> Project: Spark
> Issue Type: Bug
> Components: SQL
> Affects Versions: 2.2.1
> Reporter: Yan Jian
> Priority: Blocker
>
> Spark performs mul / div on Decimals via Java's BigDecimal, whose scale may be greater than its precision, with 38 precision limit.
> If the result BigDecimal's precision is 38, and its scale is greater than 38 ( 39 e.g. ), the converted decimal (in spark SQL) is in precision of 40 ( = 39 + 1, and > 38 ).
>
> Run following SQLs to reproduce this:
> {code:sql}
> select (cast (1.0 as decimal(38,37))) * 1.8;
> select (cast (0.00000777776666655555444443333387654321 as decimal(38,37))) / 99;
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org