rahulsmahadev 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_r335707699
 
 

 ##########
 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:
   You are right this works accurately for trailing spaces, I first enounctered 
this issue on an older release branch and it did not have the `.trim` . But the 
fix should work for trailing spaces as well if backported.

----------------------------------------------------------------
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]

Reply via email to