This is an automated email from the ASF dual-hosted git repository. gurwls223 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push: new e9cc76a27f6 [SPARK-45297][SQL] Remove workaround for dateformatter added in SPARK-31827 e9cc76a27f6 is described below commit e9cc76a27f6f372cde1c885055cfe0bdd4fd4e7d Author: Hyukjin Kwon <gurwls...@apache.org> AuthorDate: Mon Sep 25 22:15:37 2023 +0900 [SPARK-45297][SQL] Remove workaround for dateformatter added in SPARK-31827 ### What changes were proposed in this pull request? This PR removes the legacy workaround for JDK 8 added at SPARK-31827 ### Why are the changes needed? To remove legacy workaround. We dropped JDK 8 at SPARK-44112 ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Existing unittest/docs added in SPARK-31827 ### Was this patch authored or co-authored using generative AI tooling? No. Closes #43082 from HyukjinKwon/SPARK-45297. Authored-by: Hyukjin Kwon <gurwls...@apache.org> Signed-off-by: Hyukjin Kwon <gurwls...@apache.org> --- .../spark/sql/catalyst/util/DateTimeFormatterHelper.scala | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/sql/api/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeFormatterHelper.scala b/sql/api/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeFormatterHelper.scala index 43701d1d8ff..e2a897a3211 100644 --- a/sql/api/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeFormatterHelper.scala +++ b/sql/api/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeFormatterHelper.scala @@ -262,15 +262,6 @@ private object DateTimeFormatterHelper { toFormatter(builder, TimestampFormatter.defaultLocale) } - private final val bugInStandAloneForm = { - // Java 8 has a bug for stand-alone form. See https://bugs.openjdk.java.net/browse/JDK-8114833 - // Note: we only check the US locale so that it's a static check. It can produce false-negative - // as some locales are not affected by the bug. Since `L`/`q` is rarely used, we choose to not - // complicate the check here. - // TODO: remove it when we drop Java 8 support. - val formatter = DateTimeFormatter.ofPattern("LLL qqq", Locale.US) - formatter.format(LocalDate.of(2000, 1, 1)) == "1 1" - } // SPARK-31892: The week-based date fields are rarely used and really confusing for parsing values // to datetime, especially when they are mixed with other non-week-based ones; // SPARK-31879: It's also difficult for us to restore the behavior of week-based date fields @@ -328,12 +319,6 @@ private object DateTimeFormatterHelper { for (style <- unsupportedPatternLengths if patternPart.contains(style)) { throw new IllegalArgumentException(s"Too many pattern letters: ${style.head}") } - if (bugInStandAloneForm && (patternPart.contains("LLL") || patternPart.contains("qqq"))) { - throw new IllegalArgumentException("Java 8 has a bug to support stand-alone " + - "form (3 or more 'L' or 'q' in the pattern string). Please use 'M' or 'Q' instead, " + - "or upgrade your Java version. For more details, please read " + - "https://bugs.openjdk.java.net/browse/JDK-8114833") - } // In DateTimeFormatter, 'u' supports negative years. We substitute 'y' to 'u' here for // keeping the support in Spark 3.0. If parse failed in Spark 3.0, fall back to 'y'. // We only do this substitution when there is no era designator found in the pattern. --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org