File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ import java.util.Locale
2525import java .util .concurrent .{Callable , TimeUnit }
2626
2727import com .google .common .cache .CacheBuilder
28+ import com .google .common .util .concurrent .{ExecutionError , UncheckedExecutionException }
2829
2930trait DateTimeFormatterHelper {
3031 protected def toInstantWithZoneId (temporalAccessor : TemporalAccessor , zoneId : ZoneId ): Instant = {
@@ -63,10 +64,16 @@ object DateTimeFormatterHelper {
6364 }
6465
6566 def getFormatter (pattern : String , locale : Locale ): DateTimeFormatter = {
66- cache.get(
67- (pattern, locale),
68- new Callable [DateTimeFormatter ]() {
69- override def call = buildFormatter(pattern, locale)
70- })
67+ try {
68+ cache.get(
69+ (pattern, locale),
70+ new Callable [DateTimeFormatter ]() {
71+ override def call = buildFormatter(pattern, locale)
72+ })
73+ } catch {
74+ // Cache.get() may wrap the original exception.
75+ case e @ (_ : UncheckedExecutionException | _ : ExecutionError ) =>
76+ throw e.getCause
77+ }
7178 }
7279}
You can’t perform that action at this time.
0 commit comments