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/03/02 12:15:59 UTC

[GitHub] [spark] xuanyuanking commented on a change in pull request #27537: [SPARK-30668][SQL][FOLLOWUP] Raise exception instead of silent change for new TimestampFormatter

xuanyuanking commented on a change in pull request #27537: [SPARK-30668][SQL][FOLLOWUP] Raise exception instead of silent change for new TimestampFormatter
URL: https://github.com/apache/spark/pull/27537#discussion_r386358577
 
 

 ##########
 File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateFormatter.scala
 ##########
 @@ -124,4 +135,24 @@ object DateFormatter {
   def apply(zoneId: ZoneId): DateFormatter = {
     getFormatter(None, zoneId)
   }
+
+  def hasDiffResult(s: String, format: String, zoneId: ZoneId): Boolean = {
+    // Only check whether we will get different results between legacy format and new format, while
+    // legacy time parser policy set to EXCEPTION. For legacy parser, DateTimeParseException will
+    // not be thrown. On the contrary, if the legacy policy set to CORRECTED,
+    // DateTimeParseException will address by the caller side.
+    if (LegacyBehaviorPolicy.withName(
+        SQLConf.get.getConf(SQLConf.LEGACY_TIME_PARSER_POLICY)) == EXCEPTION) {
+      val formatter = new LegacySimpleTimestampFormatter(
+        format, zoneId, defaultLocale, lenient = false)
 
 Review comment:
   Thanks, done in 47d2f80

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