MaxGekk opened a new pull request #31831:
URL: https://github.com/apache/spark/pull/31831


   ### 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 the `Cast` expression.
   
   ### Why are the changes needed?
   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
   ```
   
   ### Does this PR introduce _any_ user-facing change?
   Yes. After the changes:
   ```sql
   spark-sql> SELECT TIMESTAMP_SECONDS(16777215.0f);
   1970-07-14 07:20:15
   ```
   
   ### How was this patch tested?
   By running new test:
   ```
   $ build/sbt "test:testOnly *DateExpressionsSuite"
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to