TJX2014 commented on a change in pull request #28534:
URL: https://github.com/apache/spark/pull/28534#discussion_r427821455



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala
##########
@@ -3495,6 +3495,24 @@ class SQLQuerySuite extends QueryTest with 
SharedSparkSession with AdaptiveSpark
     assert(df4.schema.head.name === "randn(1)")
     checkIfSeedExistsInExplain(df2)
   }
+
+  test("SPARK-31710: " +
+    "TIMESTAMP_SECONDS, TIMESTAMP_MILLISECONDS and TIMESTAMP_MICROSECONDS to 
timestamp transfer") {
+    val df1 = sql("select TIMESTAMP_SECONDS(1230219000)," +
+      "TIMESTAMP_SECONDS(-1230219000),TIMESTAMP_SECONDS(null)")
+    checkAnswer(df1, Row(Timestamp.valueOf("2008-12-25 07:30:00"),
+      Timestamp.valueOf("1931-01-07 00:30:00"), null))
+
+    val df2 = sql("select TIMESTAMP_MILLISECONDS(1230219000000)," +
+      "TIMESTAMP_MILLISECONDS(-1230219000000),TIMESTAMP_MILLISECONDS(null)")
+    checkAnswer(df2, Row(Timestamp.valueOf("2008-12-25 07:30:00"),
+      Timestamp.valueOf("1931-01-07 00:30:00"), null))
+
+    val df3 = sql("select TIMESTAMP_MICROSECONDS(1230219000000000)," +
+      "TIMESTAMP_MICROSECONDS(-1230219000000000),TIMESTAMP_MICROSECONDS(null)")
+    checkAnswer(df3, Row(Timestamp.valueOf("2008-12-25 07:30:00"),
+      Timestamp.valueOf("1931-01-07 00:30:00"), null))

Review comment:
       It seems we can remove the test in `SQLQuerySuite`, may be I have a 
misunderstanding to `datetime.sql` and the usage.




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