cloud-fan commented on a change in pull request #35432:
URL: https://github.com/apache/spark/pull/35432#discussion_r801678659



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceRDD.scala
##########
@@ -126,14 +127,9 @@ private class MetricsHandler extends Logging with 
Serializable {
 private abstract class MetricsIterator[I](iter: Iterator[I]) extends 
Iterator[I] {
   protected val metricsHandler = new MetricsHandler
 
-  override def hasNext: Boolean = {
-    if (iter.hasNext) {
-      true
-    } else {
-      metricsHandler.updateMetrics(0, force = true)
-      false
-    }
-  }
+  override def hasNext: Boolean = iter.hasNext

Review comment:
       Can we keep updating metrics at the end of the iterator? It's still 
useful in cases like `RDD.coalesce`, where a task consumes multiple iterators 
for coalesced partitions, and we can update metrics earlier 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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



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

Reply via email to