michaelmitchell-bit opened a new pull request, #56906:
URL: https://github.com/apache/spark/pull/56906

   ### What changes were proposed in this pull request?
   
   This PR routes timestamp constructor overflow through `DATETIME_OVERFLOW` 
instead of raw `ArithmeticException` for overflowing `timestamp_seconds` and 
`timestamp_millis` inputs.
   
   It adds a shared `QueryExecutionErrors` helper for timestamp constructor 
overflow, uses it from interpreted and code-generated expression paths, and 
keeps the existing non-overflow decimal rounding behavior unchanged.
   
   ### Why are the changes needed?
   
   The existing overflow paths can surface raw Java arithmetic errors such as 
`long overflow` or `Overflow`, which do not carry a Spark error condition or 
SQLSTATE. These timestamp constructor overflow cases should report a Spark 
error condition, consistent with other datetime overflow handling.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. Overflowing `timestamp_seconds` and `timestamp_millis` inputs now fail 
with `DATETIME_OVERFLOW` / SQLSTATE `22008` instead of a raw 
`ArithmeticException`.
   
   ### How was this patch tested?
   
   ```
   ./build/sbt "catalyst/testOnly 
org.apache.spark.sql.catalyst.expressions.DateExpressionsSuite -- -z 
TIMESTAMP_SECONDS -z TIMESTAMP_MILLIS -z TIMESTAMP_MICROS"
   ./build/sbt "sql/testOnly 
org.apache.spark.sql.errors.QueryExecutionErrorsSuite -- -z constructors"
   ```
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: OpenAI Codex
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to