-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-53319][SQL] Support the time type by try_make_timestamp_ltz() #52063
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
base: master
Are you sure you want to change the base?
Conversation
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala
Outdated
Show resolved
Hide resolved
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala
Show resolved
Hide resolved
changes look good, but I see the build is failing. Seems like it could be a transient issue, can you try rerunning the build?
|
Docker Integration failure looks unrelated to these changes, re-running to confirm. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changes LGTM!
cc @cloud-fan for review |
@cloud-fan Please review. |
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/datetimeExpressions.scala
Outdated
Show resolved
Hide resolved
…essions/datetimeExpressions.scala
if (numArgs == 2 || numArgs == 3) { | ||
// Overload for: date, time[, timezone]. | ||
TryEval( | ||
MakeTimestampFromDateTime( |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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
Arguments
date
: A date expression.time
: A time expression.Returns
A
TIMESTAMP_LTZ
.Examples
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.