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 2022/12/16 23:29:00 UTC
[jira] [Assigned] (SPARK-41554) Decimal.changePrecision produces ArrayIndexOutOfBoundsException
[ https://issues.apache.org/jira/browse/SPARK-41554?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Apache Spark reassigned SPARK-41554:
------------------------------------
Assignee: (was: Apache Spark)
> Decimal.changePrecision produces ArrayIndexOutOfBoundsException
> ---------------------------------------------------------------
>
> Key: SPARK-41554
> URL: https://issues.apache.org/jira/browse/SPARK-41554
> Project: Spark
> Issue Type: Bug
> Components: SQL
> Affects Versions: 3.3.1
> Reporter: Oleksiy Dyagilev
> Priority: Major
>
> {{Reducing Decimal scale by more than 18 produces exception.}}
> {code:java}
> Decimal(1, 38, 19).changePrecision(38, 0){code}
> {code:java}
> java.lang.ArrayIndexOutOfBoundsException: 19
> at org.apache.spark.sql.types.Decimal.changePrecision(Decimal.scala:377)
> at org.apache.spark.sql.types.Decimal.changePrecision(Decimal.scala:328){code}
> Reproducing with SQL query:
> {code:java}
> sql("select cast(cast(cast(cast(id as decimal(38,15)) as decimal(38,30)) as decimal(38,37)) as decimal(38,17)) from range(3)").show{code}
> The bug exists for {{Decimal}} that is stored using compact long only, it works fine with {{Decimal}} that uses {{scala.math.BigDecimal}} internally.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org