gengliangwang commented on a change in pull request #32846:
URL: https://github.com/apache/spark/pull/32846#discussion_r648467906



##########
File path: 
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/CastSuite.scala
##########
@@ -1711,6 +1708,17 @@ class CastSuite extends CastSuiteBase {
     }
   }
 
+  test("SPARK-35698: cast timestamp without time zone to string") {
+    Seq(
+      "0001-01-01 00:00:00", // the fist timestamp of Common Era
+      "1582-10-15 23:59:59", // the cutover date from Julian to Gregorian 
calendar
+      "1970-01-01 00:00:00", // the epoch timestamp
+      "9999-12-31 23:59:59"  // the last supported timestamp according to SQL 
standard
+    ).foreach { s =>
+      checkEvaluation(cast(LocalDateTime.parse(s.replace(" ", "T")), 
StringType), s)

Review comment:
       well, the result won't contain the "T", so we have to replace one of 
them eventually.
   The test inputs are from 
https://github.com/apache/spark/blob/master/sql/catalyst/src/test/scala/org/apache/spark/sql/RandomDataGenerator.scala#L156




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

Reply via email to