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/02/10 10:46:10 UTC

[GitHub] [spark] HyukjinKwon commented on a change in pull request #27498: [SPARK-30688][SQL] Week based dates not being parsed with TimestampFormatter

HyukjinKwon commented on a change in pull request #27498: [SPARK-30688][SQL] Week based dates not being parsed with TimestampFormatter
URL: https://github.com/apache/spark/pull/27498#discussion_r376987378
 
 

 ##########
 File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeFormatterHelper.scala
 ##########
 @@ -68,6 +68,17 @@ private object DateTimeFormatterHelper {
     new DateTimeFormatterBuilder().parseCaseInsensitive()
   }
 
+  def toWeekBasedFormatter(builder: DateTimeFormatterBuilder, locale: Locale): DateTimeFormatter = {
+    builder
+      .parseDefaulting(ChronoField.ERA, 1)
+      .parseDefaulting(ChronoField.DAY_OF_WEEK, 1)
+      .parseDefaulting(ChronoField.MINUTE_OF_HOUR, 0)
+      .parseDefaulting(ChronoField.SECOND_OF_MINUTE, 0)
+      .toFormatter(locale)
+      .withChronology(IsoChronology.INSTANCE)
+      .withResolverStyle(ResolverStyle.STRICT)
 
 Review comment:
   Can you add https://bugs.openjdk.java.net/browse/JDK-8145633 into PR description and elaborate how this works around?

----------------------------------------------------------------
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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org