Skip to content

Conversation

@ganeshashree
Copy link

What changes were proposed in this pull request?

Enhanced timestampAddInterval in DateTimeUtils to catch ArithmeticException during timestamp overflow and re-throw with contextual information including the input timestamp value and interval parameters.

Why are the changes needed?

When users encounter timestamp overflow errors, the current generic "long overflow" message provides no context about which timestamp values caused the issue. This makes debugging difficult, especially in production environments with large datasets.

Example Error Message Improvement

Before:
java.lang.ArithmeticException: long overflow

After:
java.lang.ArithmeticException: long overflow. Input timestamp: 2262-04-11T23:47:16.854775807Z, interval: months=0, days=2, microseconds=0, zoneId=Z

Does this PR introduce any user-facing change?

Yes - users will see enhanced error messages with timestamp and interval details when overflow occurs.

How was this patch tested?

  • Added new test case in DateTimeUtilsSuite: timestamp add interval overflow with error message
  • Test creates a timestamp near Long.MaxValue, triggers overflow, and verifies error message contains contextual information
  • Existing tests continue to pass

Was this patch authored or co-authored using generative AI tooling?

Generated-by: Claude Sonnet 4.5

@github-actions github-actions bot added the SQL label Dec 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants