spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [spark] HeartSaVioR commented on a change in pull request #26610: [SPARK-29973][SS] Make `processedRowsPerSecond` calculated more accurately and meaningfully
Date Thu, 21 Nov 2019 06:42:38 GMT
HeartSaVioR commented on a change in pull request #26610: [SPARK-29973][SS] Make `processedRowsPerSecond`
calculated more accurately and meaningfully
URL: https://github.com/apache/spark/pull/26610#discussion_r348916133
 
 

 ##########
 File path: sql/core/src/test/scala/org/apache/spark/sql/streaming/StreamingQueryStatusAndProgressSuite.scala
 ##########
 @@ -215,6 +218,60 @@ class StreamingQueryStatusAndProgressSuite extends StreamTest with Eventually
{
     }
   }
 
+  test("SPARK-29973: Make `processedRowsPerSecond` calculated more accurately and meaningfully")
{
+    import testImplicits._
+
+    clock = new StreamManualClock
+    val inputData = MemoryStream[Int]
+    val query = inputData.toDS()
+
+    testStream(query)(
+      StartStream(Trigger.ProcessingTime(1000), triggerClock = clock),
+      AssertStreamExecThreadIsWaitingForTime(1000),
+      AdvanceManualClock(1000),
+      WaitUntilBatchProcessed,
+      AssertOnQuery(query => {
+        assert(query.lastProgress.numInputRows == 0)
+        assert(query.lastProgress.processedRowsPerSecond == 0.0d)
+        true
+      }),
+      AddData(inputData, 1, 2),
+      AssertStreamExecThreadIsWaitingForTime(2000),
+      AdvanceManualClock(1000),
+      WaitUntilBatchProcessed,
+      AssertOnQuery(query => {
+        assert(query.lastProgress.numInputRows == 2)
+        assert(query.lastProgress.processedRowsPerSecond == 2000d)
+        true
+      }),
+      StopStream
+    )
+  }
+
+  case class AssertStreamExecThreadIsWaitingForTime(targetTime: Long)
 
 Review comment:
   I wouldn't think this is needed after reflecting my comment or fixing the UT correctly,
but if it turns out we need this, please don't just copy & paste - extract existing class
to the test utility class.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Mime
View raw message