spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Davies Liu (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (SPARK-8802) Decimal.apply(BigDecimal).toBigDecimal may throw NumberFormatException
Date Thu, 06 Aug 2015 23:10:04 GMT

     [ 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


Mime
View raw message