WweiL commented on code in PR #46740:
URL: https://github.com/apache/spark/pull/46740#discussion_r1621504283
##########
python/pyspark/sql/tests/streaming/test_streaming.py:
##########
@@ -392,6 +392,31 @@ def test_streaming_with_temporary_view(self):
set([Row(value="view_a"), Row(value="view_b"),
Row(value="view_c")]), set(result)
)
+ def test_streaming_drop_duplicate_within_watermark(self):
+ """
+ This verfies dropDuplicatesWithinWatermark works with a streaming
dataframe.
+ """
+ user_schema = StructType().add("time", TimestampType()).add("id",
"integer")
+ df = (
+ self.spark.readStream.option("sep", ";")
+ .schema(user_schema)
+ .csv("python/test_support/sql/streaming/time")
+ )
+ q1 = (
+ df.withWatermark("time", "2 seconds")
+ .dropDuplicatesWithinWatermark(["id"])
+ .writeStream.outputMode("update")
+ .format("memory")
+ .queryName("q1")
+ .trigger(availableNow=True)
+ .start()
+ )
+ self.assertTrue(q1.isActive)
+ time.sleep(20)
Review Comment:
Instead of using time.sleep(20). let's use `query.processAllAvailable()` for
test purpose
--
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]