srowen 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_r348887687
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/ProgressReporter.scala
 ##########
 @@ -148,8 +148,12 @@ trait ProgressReporter extends Logging {
     currentTriggerEndTimestamp = triggerClock.getTimeMillis()
 
     val executionStats = extractExecutionStats(hasNewData)
-    val processingTimeSec =
-      (currentTriggerEndTimestamp - currentTriggerStartTimestamp).toDouble / 
MILLIS_PER_SECOND
+    val processingTimeMillis = currentTriggerEndTimestamp - 
currentTriggerStartTimestamp
+    val processingTimeSec = if (processingTimeMillis == 0) {
+      0.001d
 
 Review comment:
   OK, I get it: pretend anything took at least 1 msec. Simpler might just be 
to write the line above as:
   `val processingTimeMillis = math.max(1, currentTriggerEndTimestamp - 
currentTriggerStartTimestamp)` and not have an if statement here.

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