You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Sean R. Owen (Jira)" <ji...@apache.org> on 2023/02/03 16:52:00 UTC
[jira] [Resolved] (SPARK-41554) Decimal.changePrecision produces ArrayIndexOutOfBoundsException
[ https://issues.apache.org/jira/browse/SPARK-41554?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sean R. Owen resolved SPARK-41554.
----------------------------------
Fix Version/s: 3.2.4
3.3.2
3.4.0
Resolution: Fixed
Resolved by https://github.com/apache/spark/pull/39099
> 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
> Assignee: Oleksiy Dyagilev
> Priority: Major
> Fix For: 3.2.4, 3.3.2, 3.4.0
>
>
> {{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