MaxGekk commented on a change in pull request #30687:
URL: https://github.com/apache/spark/pull/30687#discussion_r539920337
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeUtils.scala
##########
@@ -466,6 +466,15 @@ object DateTimeUtils {
}
}
+ def stringToDateAnsi(s: UTF8String, zoneId: ZoneId): Int = {
+ val date = stringToDate(s, zoneId)
+ if (date.isEmpty) {
+ throw new DateTimeException(s"Cannot cast $s to DateType.")
+ } else {
+ date.get
+ }
Review comment:
```suggestion
stringToDate(s, zoneId).getOrElse {
throw new DateTimeException(s"Cannot cast $s to DateType.")
}
```
----------------------------------------------------------------
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]