You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/06/02 11:26:18 UTC

[GitHub] [spark] juliuszsompolski commented on a change in pull request #28687: [WIP][SPARK-31878][SQL] Create date formatter only once in `HiveResult`

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



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