MaxGekk commented on a change in pull request #26143: [SPARK-29494][SQL] Fix
for ArrayOutofBoundsException while converting string to timestamp
URL: https://github.com/apache/spark/pull/26143#discussion_r335697702
##########
File path:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/util/DateTimeUtilsSuite.scala
##########
@@ -456,6 +456,18 @@ class DateTimeUtilsSuite extends SparkFunSuite with
Matchers {
}
}
+ test("trailing colon while converting string to timestamp") {
+ val s = UTF8String.fromString("2019-10-31T10:59:23Z:::")
+ val time = DateTimeUtils.stringToTimestamp(s, defaultZoneId)
+ assert(time == None)
+ }
+
+ test("trailing space while converting string to timestamp") {
+ val s = UTF8String.fromString("2019-10-31T10:59:23ZZ ")
Review comment:
`stringToTimestamp` returns None becase of invalid time zone `ZZ` at the
end. If you replace the string `"2019-10-31T10:59:23ZZ "` by
`"2019-10-31T10:59:23Z "`, the functions shouldn't return None
----------------------------------------------------------------
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]