-
Notifications
You must be signed in to change notification settings - Fork 28.4k
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
[SPARK-34737][SQL] Cast input float to double in TIMESTAMP_SECONDS
#31831
Conversation
Kubernetes integration test starting |
Kubernetes integration test status failure |
@HyukjinKwon @cloud-fan @yaooqinn @gengliangwang Could you review this PR, please. |
LGTM~ |
Merged to master. |
I would like to backport this to |
In the PR, I propose to cast the input float to double in the `SecondsToTimestamp` expression in the same way as in the `Cast` expression. To have the same results from `CAST(<float> AS TIMESTAMP)` and from `TIMESTAMP_SECONDS`: ```sql spark-sql> SELECT CAST(16777215.0f AS TIMESTAMP); 1970-07-14 07:20:15 spark-sql> SELECT TIMESTAMP_SECONDS(16777215.0f); 1970-07-14 07:20:14.951424 ``` Yes. After the changes: ```sql spark-sql> SELECT TIMESTAMP_SECONDS(16777215.0f); 1970-07-14 07:20:15 ``` By running new test: ``` $ build/sbt "test:testOnly *DateExpressionsSuite" ``` Closes apache#31831 from MaxGekk/adjust-SecondsToTimestamp. Authored-by: Max Gekk <[email protected]> Signed-off-by: HyukjinKwon <[email protected]> (cherry picked from commit 7aaed76) Signed-off-by: Max Gekk <[email protected]>
Here is the backport to 3.1: #31872 |
What changes were proposed in this pull request?
In the PR, I propose to cast the input float to double in the
SecondsToTimestamp
expression in the same way as in theCast
expression.Why are the changes needed?
To have the same results from
CAST(<float> AS TIMESTAMP)
and fromTIMESTAMP_SECONDS
:Does this PR introduce any user-facing change?
Yes. After the changes:
How was this patch tested?
By running new test: