vranes opened a new pull request, #59239: URL: https://github.com/apache/spark/pull/59239
### What changes were proposed in this pull request? This PR checks that the next BIN BY grid index is representable before it computes the end boundary of a zero-length range. It also adds a regression test for the maximum TIMESTAMP_NTZ value. ### Why are the changes needed? For a zero-length TIMESTAMP_NTZ range at `Long.MaxValue`, a 1-microsecond bin width, and an epoch origin, the containing grid index is `Long.MaxValue`. The previous `k + 1` calculation wrapped to `Long.MinValue`. BIN BY then emitted a bin whose end was before its start instead of reporting an overflow. ### Does this PR introduce _any_ user-facing change? Yes. This changes the unreleased BIN BY operator on master and branch-4.x. The affected input now raises `ARITHMETIC_OVERFLOW` instead of returning an invalid bin boundary. ### How was this patch tested? Added an end-to-end regression test to `BinBySuite` and ran: ``` build/sbt 'sql/testOnly *BinBySuite' build/sbt 'sql/scalastyle' 'sql/Test/scalastyle' ``` All 26 `BinBySuite` tests passed. Both Scalastyle tasks completed with no findings. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: OpenAI Codex (GPT-5) -- 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]
