HeartSaVioR commented on a change in pull request #25987: [SPARK-29314][SS] 
Don't overwrite the metric "updated" of state operator to 0 if empty batch is 
run
URL: https://github.com/apache/spark/pull/25987#discussion_r405218658
 
 

 ##########
 File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/ProgressReporter.scala
 ##########
 @@ -205,26 +205,28 @@ trait ProgressReporter extends Logging {
   }
 
   /** Extract statistics about stateful operators from the executed query 
plan. */
-  private def extractStateOperatorMetrics(hasNewData: Boolean): 
Seq[StateOperatorProgress] = {
+  private def extractStateOperatorMetrics(
+      hasNewData: Boolean,
+      runBatch: Boolean): Seq[StateOperatorProgress] = {
     if (lastExecution == null) return Nil
-    // lastExecution could belong to one of the previous triggers if 
`!hasNewData`.
+    // lastExecution could belong to one of the previous triggers if 
`!hasNewData && !runBatch`.
     // Walking the plan again should be inexpensive.
     lastExecution.executedPlan.collect {
       case p if p.isInstanceOf[StateStoreWriter] =>
         val progress = p.asInstanceOf[StateStoreWriter].getProgress()
-        if (hasNewData) progress else progress.copy(newNumRowsUpdated = 0)
+        if (hasNewData || runBatch) progress else 
progress.copy(newNumRowsUpdated = 0)
 
 Review comment:
   Yeah I'll resolve conflict and use `hasExecuted`. Thanks!

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