MaxGekk commented on a change in pull request #27617: [SPARK-30865][SQL] 
Refactor DateTimeUtils
URL: https://github.com/apache/spark/pull/27617#discussion_r381852391
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeUtils.scala
 ##########
 @@ -39,29 +39,23 @@ import org.apache.spark.unsafe.types.{CalendarInterval, 
UTF8String}
  */
 object DateTimeUtils {
 
-  // we use Int and Long internally to represent [[DateType]] and 
[[TimestampType]]
-  type SQLDate = Int
-  type SQLTimestamp = Long
+  type SQLDate = DateType.InternalType
+  type SQLTimestamp = TimestampType.InternalType
 
   // see 
http://stackoverflow.com/questions/466321/convert-unix-timestamp-to-julian
   // it's 2440587.5, rounding up to compatible with Hive
   final val JULIAN_DAY_OF_EPOCH = 2440588
 
-  final val TimeZoneGMT = TimeZone.getTimeZone("GMT")
-  final val TimeZoneUTC = TimeZone.getTimeZone("UTC")
-
   val TIMEZONE_OPTION = "timeZone"
 
-  def defaultTimeZone(): TimeZone = TimeZone.getDefault()
-
   def getZoneId(timeZoneId: String): ZoneId = ZoneId.of(timeZoneId, 
ZoneId.SHORT_IDS)
   def getTimeZone(timeZoneId: String): TimeZone = {
     TimeZone.getTimeZone(getZoneId(timeZoneId))
   }
 
   // we should use the exact day as Int, for example, (year, month, day) -> day
   def millisToDays(millisUtc: Long): SQLDate = {
-    millisToDays(millisUtc, defaultTimeZone().toZoneId)
+    millisToDays(millisUtc, ZoneId.systemDefault())
 
 Review comment:
   An user can change the system time zone. If we make it as a constant, the 
function will not respect to new settings. 

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