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 try_make_timestamp_ltz function, and accept a date and time fields.

Syntax

try_make_timestamp_ltz(date[, time])

Arguments

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

Returns
A TIMESTAMP_LTZ.

Examples

> SELECT try_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 try_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 try_make_timestamp_ltz() [SPARK-53319][SQL] Support the time type by try_make_timestamp_ltz() Aug 18, 2025
@uros-db
Copy link
Contributor Author

uros-db commented Aug 27, 2025

Since this PR is essentially a sibling of #52062, @jcw024 please take a look.

@uros-db uros-db requested a review from jcw024 August 28, 2025 09:47
@jcw024
Copy link

jcw024 commented Aug 29, 2025

changes look good, but I see the build is failing. Seems like it could be a transient issue, can you try rerunning the build?

[info] org.apache.spark.sql.jdbc.v2.OracleIntegrationSuite *** ABORTED *** (10 minutes, 27 seconds)
[info]   The code passed to eventually never returned normally. Attempted 597 times over 10.013027888883332 minutes. Last failure message: ORA-12541: Cannot connect. No listener at host 10.1.0.179 port 46213. (CONNECTION_ID=tVMC8FrXRXCxzbqeGvL7pw==)

@uros-db
Copy link
Contributor Author

uros-db commented Aug 29, 2025

Docker Integration failure looks unrelated to these changes, re-running to confirm.

Copy link

@jcw024 jcw024 left a comment

Choose a reason for hiding this comment

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

changes LGTM!

@jcw024
Copy link

jcw024 commented Aug 30, 2025

cc @cloud-fan for review

@uros-db
Copy link
Contributor Author

uros-db commented Oct 13, 2025

@cloud-fan Please review.

if (numArgs == 2 || numArgs == 3) {
// Overload for: date, time[, timezone].
TryEval(
MakeTimestampFromDateTime(
Copy link
Contributor

Choose a reason for hiding this comment

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

shall we add the failOnError flag to MakeTimestampFromDateTime as well? TryEval is not very reliable as it may mistakenly catch errors from the function argument expressions.

Copy link
Contributor Author

@uros-db uros-db Oct 14, 2025

Choose a reason for hiding this comment

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

I don't think we have to do that here, because invalid date/time here would throw parse exceptions before that point anyways (both in ANSI and non-ANSI). In this sense, it's a different kind of situation compared to integer construction (year, month, day, hour, min) of MakeTimestamp below for example.

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