Skip to content

Conversation

uros-db
Copy link
Contributor

@uros-db uros-db commented Aug 18, 2025

What changes were proposed in this pull request?

In the PR, I propose to extend the make_timestamp_ltz function, and accept a date and time fields.

Syntax

make_timestamp_ltz(date[, time])

Arguments

  • date: A date expression.
  • time: A time expression.

Returns
A TIMESTAMP_LTZ.

Examples

> SELECT make_timestamp_ltz(DATE'2014-12-28', TIME'6:30:45.887');
 2014-12-28 06:30:45.887

Why are the changes needed?

Users will be able to create a timestamp with local time zone by combining a time and a date.

Does this PR introduce any user-facing change?

Yes, this extends make_timestamp_ltz to accept additional kinds of inputs.

How was this patch tested?

Added new e2e SQL tests in corresponding golden files.

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

No.

@github-actions github-actions bot added the SQL label Aug 18, 2025
@uros-db uros-db changed the title Support the time type by make_timestamp_ltz() [SPARK-53318][SQL] Support the time type by make_timestamp_ltz() Aug 18, 2025
@jcw024
Copy link

jcw024 commented Aug 26, 2025

Can we also update the examples with the new usage?

examples = """
Examples:
SELECT FUNC(2014, 12, 28, 6, 30, 45.887);
2014-12-28 06:30:45.887
SELECT FUNC(2014, 12, 28, 6, 30, 45.887, 'CET');
2014-12-27 21:30:45.887
SELECT FUNC(2019, 6, 30, 23, 59, 60);
2019-07-01 00:00:00
SELECT FUNC(null, 7, 22, 15, 30, 0);
NULL
""",

@uros-db
Copy link
Contributor Author

uros-db commented Aug 26, 2025

Can we also update the examples with the new usage?

Sure! Added two new expression examples.

@uros-db uros-db requested a review from jcw024 August 26, 2025 07:34
@jcw024
Copy link

jcw024 commented Aug 27, 2025

Thanks for making the updates. Just a couple last suggestions, can we also update the arguments to include date similar to how it's done in the other MakeTimestamp ExpressionBuilders?

  * date - a date to represent, from 0001-01-01 to 9999-12-31

Also, I'm wondering if we should also apply similar changes to TryMakeTimestampLTZExpressionBuilder. I think it would make sense to also go in this PR since the change is so similar, but I'm not sure how it was done for the other TryMakeTimestamp ExpressionBuilders

@uros-db
Copy link
Contributor Author

uros-db commented Aug 27, 2025

@jcw024 Arguments updated accordingy. As for try_make_timestamp_ltz - please see: #52063.

@jcw024
Copy link

jcw024 commented Aug 28, 2025

changes LGTM!

@uros-db
Copy link
Contributor Author

uros-db commented Aug 28, 2025

@cloud-fan Please review.

@cloud-fan
Copy link
Contributor

thanks, merging to master!

@cloud-fan cloud-fan closed this in 316d06b Aug 28, 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.

3 participants