You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/05/19 06:18:52 UTC
[GitHub] [spark] cloud-fan commented on a change in pull request #28576: [SPARK-31755][SQL] allow missing year/hour when parsing date/timestamp string
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` too, 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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org