cloud-fan commented on a change in pull request #32959:
URL: https://github.com/apache/spark/pull/32959#discussion_r655094670
##########
File path:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/util/DateTimeUtilsSuite.scala
##########
@@ -283,6 +298,22 @@ class DateTimeUtilsSuite extends SparkFunSuite with
Matchers with SQLHelper {
}
}
+ test("SPARK-35780: support full range of timestamp string") {
+ def checkStringToTimestamp(str: String, expected: Option[Long]): Unit = {
+ assert(toTimestamp(str, UTC) === expected)
+ }
+
+ checkStringToTimestamp("-1969-12-31 16:00:00", Option(date(-1969, 12, 31,
16, zid = UTC)))
+ checkStringToTimestamp("02015-03-18 16:00:00", Option(date(2015, 3, 18,
16, zid = UTC)))
+ checkStringToTimestamp("015-03-18 16:00:00", Option(date(15, 3, 18, 16,
zid = UTC)))
+ checkStringToTimestamp("000001", Option(date(1, 1, 1, 0, zid = UTC)))
+ checkStringToTimestamp("-000001", Option(date(-1, 1, 1, 0, zid = UTC)))
+ checkStringToTimestamp("99999-03-18T12:03:17",
+ Option(date(99999, 3, 18, 12, 3, 17, zid = UTC)))
+ checkStringToTimestamp("-99999-03-18T12:03:17",
+ Option(date(-99999, 3, 18, 12, 3, 17, zid = UTC)))
+ }
+
Review comment:
we also need end-to-end test
--
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]