File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,12 @@ trait DateTimeFormatterHelper {
40
40
Instant .from(zonedDateTime)
41
41
}
42
42
43
+ // Gets a formatter from the cache or creates new one. The buildFormatter method can be called
44
+ // a few times with the same parameters in parallel if the cache does not contain values
45
+ // associated to those parameters. Since the formatter is immutable, it does not matter.
46
+ // In this way, synchronised is intentionally omitted in this method to make parallel calls
47
+ // less synchronised.
48
+ // The Cache.get method is not used here to avoid creation of additional instances of Callable.
43
49
protected def getOrCreateFormatter (pattern : String , locale : Locale ): DateTimeFormatter = {
44
50
val key = (pattern, locale)
45
51
var formatter = cache.getIfPresent(key)
You can’t perform that action at this time.
0 commit comments