xuanyuanking commented on a change in pull request #23396: [SPARK-26397][SQL] Driver side only metrics support URL: https://github.com/apache/spark/pull/23396#discussion_r246260500
########## File path: sql/core/src/main/scala/org/apache/spark/sql/execution/DataSourceScanExec.scala ########## @@ -167,26 +167,22 @@ case class FileSourceScanExec( partitionSchema = relation.partitionSchema, relation.sparkSession.sessionState.conf) - val driverMetrics: HashMap[String, Long] = HashMap.empty - /** * Send the driver-side metrics. Before calling this function, selectedPartitions has * been initialized. See SPARK-26327 for more details. */ private def sendDriverMetrics(): Unit = { - driverMetrics.foreach(e => metrics(e._1).add(e._2)) val executionId = sparkContext.getLocalProperty(SQLExecution.EXECUTION_ID_KEY) - SQLMetrics.postDriverMetricUpdates(sparkContext, executionId, - metrics.filter(e => driverMetrics.contains(e._1)).values.toSeq) + SQLMetrics.postDriverMetricUpdates(sparkContext, executionId, driverMetrics.values.toSeq) } @transient private lazy val selectedPartitions: Seq[PartitionDirectory] = { val optimizerMetadataTimeNs = relation.location.metadataOpsTimeNs.getOrElse(0L) val startTime = System.nanoTime() val ret = relation.location.listFiles(partitionFilters, dataFilters) - driverMetrics("numFiles") = ret.map(_.files.size.toLong).sum + driverMetrics("numFiles").add(ret.map(_.files.size.toLong).sum) Review comment: Yes, use set is more accurate. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on 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 With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org