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
25
25
import java .util .concurrent .{Callable , TimeUnit }
26
26
27
27
import com .google .common .cache .CacheBuilder
28
+ import com .google .common .util .concurrent .{ExecutionError , UncheckedExecutionException }
28
29
29
30
trait DateTimeFormatterHelper {
30
31
protected def toInstantWithZoneId (temporalAccessor : TemporalAccessor , zoneId : ZoneId ): Instant = {
@@ -63,10 +64,16 @@ object DateTimeFormatterHelper {
63
64
}
64
65
65
66
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
+ }
71
78
}
72
79
}
You can’t perform that action at this time.
0 commit comments