HeartSaVioR commented on a change in pull request #26610: [SPARK-29973][SS] Use 
nano time to avoid 'NaN'/'Infinity'
URL: https://github.com/apache/spark/pull/26610#discussion_r348854893
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/ProgressReporter.scala
 ##########
 @@ -145,14 +145,14 @@ trait ProgressReporter extends Logging {
   /** Finalizes the query progress and adds it to list of recent status 
updates. */
   protected def finishTrigger(hasNewData: Boolean): Unit = {
     assert(currentTriggerStartOffsets != null && currentTriggerEndOffsets != 
null)
-    currentTriggerEndTimestamp = triggerClock.getTimeMillis()
+    currentTriggerEndTimestamp = triggerClock.nanoTime()
 
     val executionStats = extractExecutionStats(hasNewData)
     val processingTimeSec =
-      (currentTriggerEndTimestamp - currentTriggerStartTimestamp).toDouble / 
MILLIS_PER_SECOND
+      (currentTriggerEndTimestamp - currentTriggerStartTimestamp).toDouble / 
NANOS_PER_SECOND
 
     val inputTimeSec = if (lastTriggerStartTimestamp >= 0) {
 
 Review comment:
   When we change to nanoTime() it's going to be no longer correct. (negative 
value is also a valid for `nanoTime()`) Change it to `Option[Long]`.

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