You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2026/06/09 06:20:00 UTC
[jira] [Updated] (SPARK-57335) element_at fails with internal error on Int.MinValue index
[ https://issues.apache.org/jira/browse/SPARK-57335?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
ASF GitHub Bot updated SPARK-57335:
-----------------------------------
Labels: pull-request-available (was: )
> element_at fails with internal error on Int.MinValue index
> ----------------------------------------------------------
>
> Key: SPARK-57335
> URL: https://issues.apache.org/jira/browse/SPARK-57335
> Project: Spark
> Issue Type: Bug
> Components: SQL
> Affects Versions: 5.0.0
> Reporter: Eric Yang
> Priority: Major
> Labels: pull-request-available
>
> {*}Issue{*}:
> element_at(arr, Int.MinValue) leaks an internal IndexOutOfBoundsException instead of returning NULL (non-ANSI) or raising INVALID_ARRAY_INDEX_IN_ELEMENT_AT (ANSI). try_element_at also throws, violating its no-throw contract.
> The exception:
> {code:java}
> java.lang.IndexOutOfBoundsException: -2147483645
> at scala.collection.LinearSeqOps.apply(LinearSeq.scala:129)
> at scala.collection.LinearSeqOps.apply$(LinearSeq.scala:128)
> at scala.collection.immutable.List.apply(List.scala:79)
> at org.apache.spark.sql.catalyst.expressions.ElementAt.nullability(collectionOperations.scala:2703)
> at org.apache.spark.sql.catalyst.expressions.ElementAt.$anonfun$nullable$4(collectionOperations.scala:2712)
> at org.apache.spark.sql.catalyst.expressions.ElementAt.$anonfun$nullable$4$adapted(collectionOperations.scala:2712)
> at org.apache.spark.sql.catalyst.expressions.GetArrayItemUtil.computeNullabilityFromArray(complexTypeExtractors.scala:447)
> at org.apache.spark.sql.catalyst.expressions.GetArrayItemUtil.computeNullabilityFromArray$(complexTypeExtractors.scala:437)
> at org.apache.spark.sql.catalyst.expressions.ElementAt.computeNullabilityFromArray(collectionOperations.scala:2624)
> at org.apache.spark.sql.catalyst.expressions.ElementAt.nullable(collectionOperations.scala:2712)
> at org.apache.spark.sql.catalyst.expressions.Alias.toAttribute(namedExpressions.scala:206)
> ... {code}
> *Repro:*
> {code:sql}
> SELECT element_at(array(1,2,3), -2147483648); -- expected NULL, throws
> SELECT try_element_at(array(1,2,3), -2147483648); -- must never throw, throws
> {code}
--
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