Github user ssonker commented on a diff in the pull request:
https://github.com/apache/spark/pull/21505#discussion_r193694372
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeUtils.scala
---
@@ -111,6 +113,23 @@ object DateTimeUtils {
computedTimeZones.computeIfAbsent(timeZoneId, computeTimeZone)
}
+ private val threadLocalComputedCalendarsMap =
+ new ThreadLocal[mutable.Map[TimeZone, Calendar]] {
+ override def initialValue(): mutable.Map[TimeZone, Calendar] = {
+ mutable.Map[TimeZone, Calendar]()
+ }
+ }
+
+ def getCalendar(timeZone: TimeZone): Calendar = {
+ val c = threadLocalComputedCalendarsMap.get()
+ .getOrElseUpdate(timeZone, {
+ Calendar.getInstance(timeZone)
+ })
+ c.clear()
--- End diff --
Nope. It clears all the ```fields``` and zone is not a field.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]