juliuszsompolski commented on a change in pull request #28687:
URL: https://github.com/apache/spark/pull/28687#discussion_r433804674



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/HiveResult.scala
##########
@@ -73,7 +73,13 @@ object HiveResult {
   }
 
   private def zoneId = 
DateTimeUtils.getZoneId(SQLConf.get.sessionLocalTimeZone)
-  private def dateFormatter = DateFormatter(zoneId)
+  // Date formatting does not depend on time zone ID because it converts local 
days
+  // since the epoch to local date string. Time zone id does matter only in 
parsing
+  // when the parser has to handle special values like `now`, `yesterday` and 
etc.
+  // Here, `dateFormatter` is used only for formatting, so, we can initialize 
it by
+  // any time zone once, for instance, by the current session time zone. And 
we can
+  // reuse it even when the session time zone might be changed.
+  private val dateFormatter = DateFormatter(zoneId)

Review comment:
       Yes, it can be called concurrently (e.g. by concurrent thriftserver 
queries).




----------------------------------------------------------------
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:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to