Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-37935 Migrate onto error classes
  3. SPARK-39827

add_months() returns a java error on overflow

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.4.0
    • 3.4.0
    • SQL
    • None

    Description

      The code below throws an Java exception, see

      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) 

      but it should throw Spark's exception w/ an error class.

      Attachments

        Activity

          People

            maxgekk Max Gekk
            maxgekk Max Gekk
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: