cloud-fan commented on a change in pull request #28576:
URL: https://github.com/apache/spark/pull/28576#discussion_r427054501



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeFormatterHelper.scala
##########
@@ -72,18 +94,14 @@ trait DateTimeFormatterHelper {
   // DateTimeParseException will address by the caller side.
   protected def checkDiffResult[T](
       s: String, legacyParseFunc: String => T): PartialFunction[Throwable, T] 
= {
-    case e: DateTimeParseException if SQLConf.get.legacyTimeParserPolicy == 
EXCEPTION =>
-      val res = try {
-        Some(legacyParseFunc(s))
-      } catch {
-        case _: Throwable => None
-      }
-      if (res.nonEmpty) {
+    case e: DateTimeException if SQLConf.get.legacyTimeParserPolicy == 
EXCEPTION =>

Review comment:
       when the field value exceeds the valid range, the JDK throws 
`DateTimeException, we should catch it. `DateTimeParseException` extends 
`DateTimeException`




----------------------------------------------------------------
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to