LuciferYang commented on code in PR #45817:
URL: https://github.com/apache/spark/pull/45817#discussion_r1547730987


##########
sql/api/src/main/scala/org/apache/spark/sql/catalyst/util/SparkDateTimeUtils.scala:
##########
@@ -223,12 +212,7 @@ trait SparkDateTimeUtils {
   def toJavaDate(days: Int): Date = {
     val rebasedDays = rebaseGregorianToJulianDays(days)
     val localMillis = Math.multiplyExact(rebasedDays, MILLIS_PER_DAY)
-    val timeZoneOffset = TimeZone.getDefault match {
-      case zoneInfo: TimeZone if zoneInfo.getClass.getName == 
zoneInfoClassName =>
-        getOffsetsByWallHandle.invoke(zoneInfo, localMillis, 
null).asInstanceOf[Int]
-      case timeZone: TimeZone =>
-        timeZone.getOffset(localMillis - timeZone.getRawOffset)
-    }
+    val timeZoneOffset = TimeZone.getDefault.getOffset(localMillis)

Review Comment:
   In https://github.com/apache/spark/pull/45716, I replaced the direct call to 
`sun.util.calendar.ZoneInfo` with the use of `MethodHandle` in order to make 
Spark 4.0 to be build with `-release`. 
   
   However, referring to the `fromJavaDate` function, I wonder if we can 
directly use `TimeZone.getDefault.getOffset(localMillis)` here?
   
   
   
https://github.com/apache/spark/blob/03f4e45cd7e9e45149b45f3611efd85375e7a327/sql/api/src/main/scala/org/apache/spark/sql/catalyst/util/SparkDateTimeUtils.scala#L193-L198
   
   All unit tests have passed with this pr. Is there any other reason that 
`sun.util.calendar.ZoneInfo` must be used here?
   
   @hvanhovell @MaxGekk @dongjoon-hyun @HyukjinKwon 



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to