TJX2014 commented on a change in pull request #28534:
URL: https://github.com/apache/spark/pull/28534#discussion_r427767257
##########
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:
I have added these sqls to `datetime.sql`, but not sure `datetime.sql`
will check the correctness of these functions,so these checks is not removed
currently, could you please give me a help and decide if these should retain?
@cloud-fan
----------------------------------------------------------------
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]