-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-31797][SQL][FOLLOWUP] TIMESTAMP_SECONDS supports fractional input #28956
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
Changes from all commits
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 |
|---|---|---|
|
|
@@ -2,13 +2,18 @@ | |
|
|
||
| -- [SPARK-31710] TIMESTAMP_SECONDS, TIMESTAMP_MILLISECONDS and TIMESTAMP_MICROSECONDS to timestamp transfer | ||
| select TIMESTAMP_SECONDS(1230219000),TIMESTAMP_SECONDS(-1230219000),TIMESTAMP_SECONDS(null); | ||
| select TIMESTAMP_SECONDS(1.23), TIMESTAMP_SECONDS(1.23d), TIMESTAMP_SECONDS(FLOAT(1.23)); | ||
| select TIMESTAMP_MILLIS(1230219000123),TIMESTAMP_MILLIS(-1230219000123),TIMESTAMP_MILLIS(null); | ||
| select TIMESTAMP_MICROS(1230219000123123),TIMESTAMP_MICROS(-1230219000123123),TIMESTAMP_MICROS(null); | ||
| -- overflow exception: | ||
| -- overflow exception | ||
| select TIMESTAMP_SECONDS(1230219000123123); | ||
| select TIMESTAMP_SECONDS(-1230219000123123); | ||
| select TIMESTAMP_MILLIS(92233720368547758); | ||
| select TIMESTAMP_MILLIS(-92233720368547758); | ||
| -- truncate exception | ||
| select TIMESTAMP_SECONDS(0.1234567); | ||
|
Member
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. Shall we have a test case for
Member
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. This PR aims to allow truncation for both ANSI and legacy mode. Did I understand correctly?
Contributor
Author
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. yes, float/double are approximate values and truncation should be always allowed. |
||
| -- truncation is OK for float/double | ||
| select TIMESTAMP_SECONDS(0.1234567d), TIMESTAMP_SECONDS(FLOAT(0.1234567)); | ||
|
|
||
| -- [SPARK-16836] current_date and current_timestamp literals | ||
| select current_date = current_date(), current_timestamp = current_timestamp(); | ||
|
|
||
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.
This test is rewritten to increase test coverage.