-
Notifications
You must be signed in to change notification settings - Fork 28.6k
[SPARK-51415][SQL] Make timestamp from date and time #51179
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?
Changes from 1 commit
6d17c5c
6ba1ce6
24fddf8
ee89892
a751d60
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1899,3 +1899,21 @@ org.apache.spark.sql.catalyst.parser.ParseException | |
"fragment" : "timediff('YEAR', date'2020-02-15', date'2023-02-15')" | ||
} ] | ||
} | ||
|
||
|
||
-- !query | ||
SELECT make_timestamp(DATE'0001-01-01', TIME'0:0:0') | ||
-- !query analysis | ||
[Analyzer test output redacted due to nondeterminism] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's exactly non-deterministic here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not clear to me too. I have leaved a question in the PR: https://github.com/apache/spark/pull/40496/files#r2154235184 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would assume that we might call current_timestamp or similar functions that could produce different literals. But if this is the case, I would say this is the bug in the new system where we do not filter on the specific expressions, but on literals in general. cc: @dtenedor on this PR, for context |
||
|
||
|
||
-- !query | ||
SELECT make_timestamp(DATE'2025-06-14', TIME'17:25:30.5', 'CET') | ||
-- !query analysis | ||
[Analyzer test output redacted due to nondeterminism] | ||
|
||
|
||
-- !query | ||
SELECT make_timestamp(DATE'9999-12-31', TIME'23:59:59.123456') | ||
-- !query analysis | ||
[Analyzer test output redacted due to nondeterminism] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -169,3 +169,8 @@ select timediff(SECOND, date'2022-02-15', timestamp'2022-02-14 23:59:59'); | |
|
||
select timediff('MINUTE', timestamp'2023-02-14 01:02:03', timestamp'2023-02-14 02:00:03'); | ||
select timediff('YEAR', date'2020-02-15', date'2023-02-15'); | ||
|
||
-- Construct timestamp from date and time | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How do we handle null values? Can we add tests for this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added tests. Thanks. |
||
SELECT make_timestamp(DATE'0001-01-01', TIME'0:0:0'); | ||
SELECT make_timestamp(DATE'2025-06-14', TIME'17:25:30.5', 'CET'); | ||
SELECT make_timestamp(DATE'9999-12-31', TIME'23:59:59.123456'); |
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.
nit: Should we move the output type and error out comments after the second declaration of the function?
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.
SGTM