cloud-fan commented on a change in pull request #32959:
URL: https://github.com/apache/spark/pull/32959#discussion_r666414107
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeUtils.scala
##########
@@ -249,70 +249,107 @@ object DateTimeUtils {
* the input string can't be parsed as timestamp, the result
timestamp segments are empty.
*/
def parseTimestampString(s: UTF8String): (Array[Int], Option[ZoneId],
Boolean) = {
- if (s == null) {
+ def isValidDigits(segment: Int, digits: Int): Boolean = {
+ // A Long is able to represent a timestamp within [+-]200 thousand years
+ val maxDigitsYear = 6
+ // For the nanosecond part, more than 6 digits is allowed, but will be
truncated.
+ segment == 6 || (segment == 0 && digits > 0 && digits <= maxDigitsYear)
||
+ (segment != 0 && segment != 6 && digits <= 2)
Review comment:
good catch, we should fail it. Let's do it in another PR.
--
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]