Github user viirya commented on a diff in the pull request:
https://github.com/apache/spark/pull/20163#discussion_r160017370
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeUtils.scala
---
@@ -193,6 +193,24 @@ object DateTimeUtils {
millisToDays(date.getTime)
}
+ /**
+ * Returns the number of days since epoch from java.util.Calendar
+ */
+ def fromJavaCalendarForDate(cal: Calendar): SQLDate = {
+ val ms = cal.getTimeInMillis
+ cal.getTimeZone match {
+ case null => millisToDays(ms)
+ case tz => millisToDays(ms, tz)
+ }
+ }
+
+ /**
+ * Returns SQLTimestamp from java.util.Calendar (microseconds since
epoch)
--- End diff --
(Matching the comment of fromJavaCalendarForDate.)
nit: Returns the number of microseconds since epoch from java.util.Calendar.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]