HeartSaVioR commented on a change in pull request #25048: [SPARK-28247][SS] Fix 
flaky test "query without test harness" on ContinuousSuite 
URL: https://github.com/apache/spark/pull/25048#discussion_r300515987
 
 

 ##########
 File path: 
sql/core/src/test/scala/org/apache/spark/sql/streaming/continuous/ContinuousSuite.scala
 ##########
 @@ -38,18 +38,42 @@ class ContinuousSuiteBase extends StreamTest {
       sparkConf.set("spark.sql.testkey", "true")))
 
   protected def waitForRateSourceTriggers(query: StreamExecution, numTriggers: 
Int): Unit = {
-    query match {
+    findRateStreamContinuousStream(query).foreach { reader =>
+      val deltaMs = numTriggers * 1000 + 300
+      val firstCommittedTime = reader.firstCommittedTime.longValue()
+      while (System.currentTimeMillis < firstCommittedTime + deltaMs) {
+        Thread.sleep(firstCommittedTime + deltaMs - System.currentTimeMillis)
+      }
+    }
+  }
+
+  protected def waitForRateSourceCommittedValue(
 
 Review comment:
   This is safest approach to expect some rows to produce outputs. We still 
need to have max time to wait, since it may block infinitely in case of bugs.

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to