cloud-fan commented on a change in pull request #27618: [SPARK-30869][SQL]
Convert dates to/from timestamps in microseconds precision
URL: https://github.com/apache/spark/pull/27618#discussion_r382415458
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeUtils.scala
##########
@@ -88,14 +86,14 @@ object DateTimeUtils {
* Returns the number of days since epoch from java.sql.Date.
*/
def fromJavaDate(date: Date): SQLDate = {
- millisToDays(date.getTime)
+ microsToDays(Math.multiplyExact(date.getTime, MICROS_PER_MILLIS))
}
/**
* Returns a java.sql.Date from number of days since epoch.
*/
def toJavaDate(daysSinceEpoch: SQLDate): Date = {
- new Date(daysToMillis(daysSinceEpoch))
+ new Date(daysToMicros(daysSinceEpoch) / MICROS_PER_MILLIS)
Review comment:
ditto, `microsToMillis(daysToMicros(daysSinceEpoch))`?
----------------------------------------------------------------
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]