MaxGekk commented on code in PR #41078:
URL: https://github.com/apache/spark/pull/41078#discussion_r1192102884
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/TimestampFormatter.scala:
##########
@@ -163,27 +165,66 @@ class Iso8601TimestampFormatter(
protected lazy val legacyFormatter = TimestampFormatter.getLegacyFormatter(
pattern, zoneId, locale, legacyFormat)
+ override def parseOptional(s: String): Option[Long] = {
+ try {
+ val parsed = formatter.parseUnresolved(s, new ParsePosition(0))
Review Comment:
`parseUnresolved()` doesn't validate correctness of its result, see its docs:
```
The result of this method is TemporalAccessor which represents the data as
seen in the input. Values are not validated, thus parsing a date string of
'2012-00-65' would result in a temporal with three fields - year of '2012',
month of '0' and day-of-month of '65'.
```
I think you should check the result yourself somewhere.
Could you re-check the example from the docs: '2012-00-65' and add a test,
please.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]