cloud-fan 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_r386421041
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateFormatter.scala
##########
@@ -98,15 +107,24 @@ object DateFormatter {
legacyFormat: LegacyDateFormat = LENIENT_SIMPLE_DATE_FORMAT):
DateFormatter = {
val pattern = format.getOrElse(defaultPattern)
- if (SQLConf.get.legacyTimeParserEnabled) {
- legacyFormat match {
- case FAST_DATE_FORMAT =>
- new LegacyFastDateFormatter(pattern, locale)
- case SIMPLE_DATE_FORMAT | LENIENT_SIMPLE_DATE_FORMAT =>
- new LegacySimpleDateFormatter(pattern, locale)
- }
+ if (SQLConf.get.legacyTimeParserPolicy == LEGACY) {
+ getLegacyFormatter(pattern, zoneId, locale, legacyFormat)
} else {
- new Iso8601DateFormatter(pattern, zoneId, locale)
+ new Iso8601DateFormatter(pattern, zoneId, locale, legacyFormat)
+ }
+ }
+
+ def getLegacyFormatter(
+ pattern: String,
Review comment:
nit: 4 space indentation.
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]