Skip to content

Conversation

andygrove
Copy link
Member

Which issue does this PR close?

Rationale for this change

Return errors rather than panicking.

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

@github-actions github-actions bot added sqllogictest SQL Logic Tests (.slt) spark labels Oct 10, 2025
@andygrove andygrove marked this pull request as ready for review October 10, 2025 18:38
@andygrove
Copy link
Member Author

@chenkovsky @shehabgamin fyi

query D
SELECT date_sub('2016-07-30'::date, 2147483647::int);
----
ERROR: Cast error: Failed to convert -2147466635 to temporal for Date32
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ERROR: Cast error: Failed to convert -2147466635 to temporal for Date32 is it a result returned by date_sub 🤔 ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. This error is unrelated to the changes in this PR, but I thought it was good to add the test.

I was expecting to see an overflow though. I will try and track down the root cause.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a test to show negative overflow

Copy link
Contributor

@comphead comphead left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @andygrove lgtm

@alamb alamb added this pull request to the merge queue Oct 10, 2025
@alamb
Copy link
Contributor

alamb commented Oct 10, 2025

🚀

Merged via the queue into apache:main with commit 832ba76 Oct 10, 2025
28 checks passed
@andygrove andygrove deleted the spark-date-add-overflow branch October 15, 2025 21:32
hareshkh pushed a commit to hareshkh/datafusion that referenced this pull request Oct 17, 2025
…18013)

* fix

* fix

* fix

* fix

* fix

* add negative overflow test

* remove unrelated test

* update test
@hareshkh
Copy link
Contributor

FYI @andygrove - created a PR to cherry-pick this to branch-50 : #18131

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

spark sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DateAdd / DateSub do not perform overflow checks in release builds

5 participants