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/07/20 12:46:00 UTC

[jira] [Commented] (SPARK-39827) add_months() returns a java error on overflow

    [ https://issues.apache.org/jira/browse/SPARK-39827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17569004#comment-17569004 ] 

Apache Spark commented on SPARK-39827:
--------------------------------------

User 'MaxGekk' has created a pull request for this issue:
https://github.com/apache/spark/pull/37240

> add_months() returns a java error on overflow
> ---------------------------------------------
>
>                 Key: SPARK-39827
>                 URL: https://issues.apache.org/jira/browse/SPARK-39827
>             Project: Spark
>          Issue Type: Sub-task
>          Components: SQL
>    Affects Versions: 3.4.0
>            Reporter: Max Gekk
>            Assignee: Max Gekk
>            Priority: Major
>
> The code below throws an Java exception, see
> {code:java}
> spark.sql("SET spark.sql.ansi.enabled=true").show()spark.sql("SELECT add_months('5500000-12-31', 10000000)").show()java.lang.ArithmeticException: integer overflow  at java.base/java.lang.Math.toIntExact(Math.java:1074)  at org.apache.spark.sql.catalyst.util.DateTimeUtils$.localDateToDays(DateTimeUtils.scala:550)  at org.apache.spark.sql.catalyst.util.DateTimeUtils$.dateAddMonths(DateTimeUtils.scala:736) {code}
> but it should throw Spark's exception w/ an error class.



--
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