beliefer commented on a change in pull request #33278:
URL: https://github.com/apache/spark/pull/33278#discussion_r666837794
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/DateFunctionsSuite.scala
##########
@@ -587,16 +587,22 @@ class DateFunctionsSuite extends QueryTest with
SharedSparkSession {
val date2 = Date.valueOf("2015-07-25")
val ts1 = Timestamp.valueOf("2015-07-24 10:00:00.3")
val ts2 = Timestamp.valueOf("2015-07-25 02:02:02.2")
+ val ntzTs1 = LocalDateTime.parse("2015-07-24T10:00:00.3")
+ val ntzTs2 = LocalDateTime.parse("2015-07-25T02:02:02.2")
val s1 = "2015/07/24 10:00:00.5"
val s2 = "2015/07/25 02:02:02.6"
val ss1 = "2015-07-24 10:00:00"
val ss2 = "2015-07-25 02:02:02"
val fmt = "yyyy/MM/dd HH:mm:ss.S"
- val df = Seq((date1, ts1, s1, ss1), (date2, ts2, s2, ss2)).toDF("d",
"ts", "s", "ss")
+ val df = Seq((date1, ts1, ntzTs1, s1, ss1), (date2, ts2, ntzTs2, s2,
ss2)).toDF(
+ "d", "ts", "ntzTs", "s", "ss")
checkAnswer(df.select(unix_timestamp(col("ts"))), Seq(
Row(secs(ts1.getTime)), Row(secs(ts2.getTime))))
checkAnswer(df.select(unix_timestamp(col("ss"))), Seq(
Row(secs(ts1.getTime)), Row(secs(ts2.getTime))))
+ checkAnswer(df.select(unix_timestamp(col("ntzTs"))), Seq(
+
Row(secs(DateTimeUtils.microsToMillis(DateTimeUtils.localDateTimeToMicros(ntzTs1)))),
+
Row(secs(DateTimeUtils.microsToMillis(DateTimeUtils.localDateTimeToMicros(ntzTs2))))))
Review comment:
`unix_timestamp` always return `LongType`. Can you explain it better?
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]