You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Davies Liu (JIRA)" <ji...@apache.org> on 2015/08/07 01:10:04 UTC
[jira] [Closed] (SPARK-8802) Decimal.apply(BigDecimal).toBigDecimal
may throw NumberFormatException
[ https://issues.apache.org/jira/browse/SPARK-8802?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Davies Liu closed SPARK-8802.
-----------------------------
Resolution: Won't Fix
Target Version/s: (was: 1.6.0)
> Decimal.apply(BigDecimal).toBigDecimal may throw NumberFormatException
> ----------------------------------------------------------------------
>
> Key: SPARK-8802
> URL: https://issues.apache.org/jira/browse/SPARK-8802
> Project: Spark
> Issue Type: Bug
> Components: SQL
> Affects Versions: 1.5.0
> Reporter: Josh Rosen
> Assignee: Josh Rosen
> Priority: Minor
>
> There exist certain BigDecimals that can be converted into Spark SQL's Decimal class but which produce Decimals that cannot be converted back to BigDecimal without throwing NumberFormatException.
> For instance:
> {code}
> val x = BigDecimal(BigInt("18889465931478580854784"), -2147483648)
> assert(Decimal(x).toBigDecimal === x)
> {code}
> will fail with an exception:
> {code}
> java.lang.NumberFormatException
> at java.math.BigDecimal.<init>(BigDecimal.java:511)
> at java.math.BigDecimal.<init>(BigDecimal.java:757)
> at scala.math.BigDecimal$.apply(BigDecimal.scala:119)
> at scala.math.BigDecimal.apply(BigDecimal.scala:324)
> at org.apache.spark.sql.types.Decimal.toBigDecimal(Decimal.scala:142)
> at org.apache.spark.sql.types.decimal.DecimalSuite$$anonfun$2.apply$mcV$sp(DecimalSuite.scala:62)
> at org.apache.spark.sql.types.decimal.DecimalSuite$$anonfun$2.apply(DecimalSuite.scala:60)
> at org.apache.spark.sql.types.decimal.DecimalSuite$$anonfun$2.apply(DecimalSuite.scala:60)
> {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