viirya commented on a change in pull request #31451: URL: https://github.com/apache/spark/pull/31451#discussion_r570444688
########## File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DataSourceV2ScanExecBase.scala ########## @@ -32,8 +32,13 @@ import org.apache.spark.util.Utils trait DataSourceV2ScanExecBase extends LeafExecNode { - override lazy val metrics = Map( - "numOutputRows" -> SQLMetrics.createMetric(sparkContext, "number of output rows")) + override lazy val metrics = { Review comment: Sounds good to me. I can work on it in follow up PRs. ########## File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/BatchScanExec.scala ########## @@ -44,8 +44,19 @@ case class BatchScanExec( override lazy val readerFactory: PartitionReaderFactory = batch.createReaderFactory() + /** + * The callback function which is called when the output iterator of input RDD is consumed + * completely. + */ + private def onOutputCompletion(reader: PartitionReader[_]) = { + reader.getCustomMetrics.foreach { metric => + longMetric(metric.getName) += metric.getValue Review comment: Good idea. I will do it. ########## File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/BatchScanExec.scala ########## @@ -44,8 +44,19 @@ case class BatchScanExec( override lazy val readerFactory: PartitionReaderFactory = batch.createReaderFactory() + /** + * The callback function which is called when the output iterator of input RDD is consumed + * completely. + */ + private def onOutputCompletion(reader: PartitionReader[_]) = { Review comment: sounds good to me. ########## File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/ContinuousScanExec.scala ########## @@ -47,6 +47,16 @@ case class ContinuousScanExec( stream.createContinuousReaderFactory() } + /** + * The callback function which is called when the output iterator of input RDD is consumed + * completely. + */ + private def onOutputCompletion(reader: PartitionReader[_]) = { + reader.getCustomMetrics.foreach { metric => + longMetric(metric.getName) += metric.getValue + } Review comment: +1 will add in later implementation PRs. ---------------------------------------------------------------- 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: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org