MaxGekk opened a new pull request #25421: [SPARK-28700][SQL] Use DECIMAL type 
for `sec` in `make_timestamp()`
URL: https://github.com/apache/spark/pull/25421
 
 
   ## What changes were proposed in this pull request?
   
   Changed type of `sec` argument in the `make_timestamp()` function from 
`DOUBLE` to `DECIMAL(8, 6)`. The scale is set to 6 to cover microsecond 
fractions, and the precision is 2 digits for seconds + 6 digits for microsecond 
fraction. New type prevents losing precision in some cases, for example:
   
   Before:
   ```sql
   spark-sql> select make_timestamp(2019, 8, 12, 0, 0, 58.000001);
   2019-08-12 00:00:58
   ```
   
   After:
   ```sql
   spark-sql> select make_timestamp(2019, 8, 12, 0, 0, 58.000001);
   2019-08-12 00:00:58.000001
   ```
   
   ## How was this patch tested?
   
   This was tested by `DateExpressionsSuite` and `pgSQL/timestamp.sql`.

----------------------------------------------------------------
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]


With regards,
Apache Git Services

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

Reply via email to