yaooqinn commented on a change in pull request #28766:
URL: https://github.com/apache/spark/pull/28766#discussion_r437971312
##########
File path:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/util/DatetimeFormatterSuite.scala
##########
@@ -51,4 +79,36 @@ trait DatetimeFormatterSuite extends SparkFunSuite with
SQLHelper with Matchers
pattern =>
intercept[SparkUpgradeException](checkFormatterCreation(pattern, true))
}
}
+
+ test("SPARK-31939: Fix Parsing day of year when year field pattern is
missing") {
+ // resolved to queryable LocaleDate or fail directly
+ assertEqual("yyyy-dd-DD", "2020-29-60", date(2020, 2, 29))
+ assertError("yyyy-dd-DD", "2020-02-60",
+ "Field DayOfMonth 29 differs from DayOfMonth 2 derived from 2020-02-29")
Review comment:
> shall we remove `derived from 2020-02-29`? looks confusing.
remove it from the test cases here or the original error? It's ok to remove
it here, but cannot be done from the original error because it is thrown by
java time lib.
> what's the error message if we run the jdk time lib directly?
`Text '2020-02-60' could not be parsed: Conflict found: Field DayOfMonth 29
differs from DayOfMonth 2 derived from 2020-02-29` is thrown by JDK. The
DatetimeException we defined just omits the leading `Text '2020-02-60' could
not be parsed: `
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]