WweiL commented on code in PR #39843:
URL: https://github.com/apache/spark/pull/39843#discussion_r1095386680
##########
sql/core/src/test/scala/org/apache/spark/sql/DataFrameTimeWindowingSuite.scala:
##########
@@ -314,6 +314,42 @@ class DataFrameTimeWindowingSuite extends QueryTest with
SharedSparkSession {
Row("1970-01-01 00:00:05", "1970-01-01 00:00:15", 2))
)
}
+
+ val df3 = Seq(
+ ("1969-12-31 00:00:02", 1),
+ ("1969-12-31 00:00:12", 2)).toDF("time", "value")
+ val df4 = Seq(
+ (LocalDateTime.parse("1969-12-31T00:00:02"), 1),
+ (LocalDateTime.parse("1969-12-31T00:00:12"), 2)).toDF("time", "value")
+
+ Seq(df3, df4).foreach { df =>
+ checkAnswer(
+ df.select(window($"time", "10 seconds", "10 seconds", "5 seconds"),
$"value")
+ .orderBy($"window.start".asc)
+ .select($"window.start".cast(StringType),
$"window.end".cast(StringType), $"value"),
+ Seq(
+ Row("1969-12-30 23:59:55", "1969-12-31 00:00:05", 1),
+ Row("1969-12-31 00:00:05", "1969-12-31 00:00:15", 2))
+ )
+ }
+
+ val df5 = Seq(
Review Comment:
Right this is actually testing some other cases, below I put year `1968` not
`1969`. The `1969` test case tests when window start is less than 0 but window
end is greater than 0. I added this case to test when both start and end are
less than 0.
--
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]