cloud-fan commented on a change in pull request #24287: [WIP][SPARK-27357][SQL] 
Cast timestamps to/from dates independently from time zones
URL: https://github.com/apache/spark/pull/24287#discussion_r273030588
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeUtils.scala
 ##########
 @@ -97,6 +97,14 @@ object DateTimeUtils {
     millisLocal - getOffsetFromLocalMillis(millisLocal, timeZone)
   }
 
+  def microsToDays(epochMicros: SQLTimestamp): SQLDate = {
+    Math.floorDiv(epochMicros, MICROS_PER_DAY).toInt
 
 Review comment:
   this one is a little tricky. There is a comment nearby, saying that 
`Math.floorDiv` is necessary because we want to support days before UTC epoch. 
Does `MICROSECONDS.toDay` handle negative values?

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