Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-50669][SQL] Change the signature of TimestampAdd expression #49291

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

stevomitric
Copy link
Contributor

What changes were proposed in this pull request?

In this PR the signature of TimestampAdd function was changed from IntegerType to LongType for quantity parameter.

Why are the changes needed?

To allow long types to be passed to timestamp_add function. Currently passing anything larger then Int32.MaxValue will cause a cast overflow exception. There is no need to restrict this method to only in32 values.

Does this PR introduce any user-facing change?

Yes, the following query passes:

select
  timestampadd(
    millisecond,
    1733011227403,
    timestamp '1970-01-01T00:00:00.000Z'
  )

Above query now returns 2024-12-01T00:00:27.000+00:00 instead of throwing a cast exception.

How was this patch tested?

New tests in this PR.

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

No

@github-actions github-actions bot added the SQL label Dec 25, 2024
@cloud-fan
Copy link
Contributor

Some tests need to be updated.

@stevomitric
Copy link
Contributor Author

Some tests need to be updated.

Updated golden files & scalastyle.

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

Successfully merging this pull request may close these issues.

2 participants