Yaoxuan Wu created SPARK-60073:
----------------------------------

             Summary: try_make_timestamp throws ArithmeticException "long 
overflow" instead of returning NULL
                 Key: SPARK-60073
                 URL: https://issues.apache.org/jira/browse/SPARK-60073
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 4.1.1, 4.2.0, 3.5.8
            Reporter: Yaoxuan Wu


{{{}try_make_timestamp{}}}, {{try_make_timestamp_ntz}} and 
{{try_make_timestamp_ltz}} are documented to return NULL on invalid input. For 
a year outside the microsecond timestamp range (about |year| > 294247), they 
throw a raw {{java.lang.ArithmeticException}} instead. This happens with ANSI 
on and off, and both for constant-folded literals and for column input.
{code:java}
SELECT try_make_timestamp(999999, 1, 2, 3, 4, 5);
-- expected: NULL
-- actual:   java.lang.ArithmeticException: long overflow
SELECT try_make_timestamp(y, 1, 2, 3, 4, 5) FROM VALUES (999999) t(y);   -- 
same {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to