You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/12/27 22:19:11 UTC

[GitHub] [spark] dongjoon-hyun commented on a change in pull request #35028: [SPARK-37578][SQL] Update task metrics from ds v2 custom metrics

dongjoon-hyun commented on a change in pull request #35028:
URL: https://github.com/apache/spark/pull/35028#discussion_r775659991



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/metric/CustomMetrics.scala
##########
@@ -52,7 +55,18 @@ object CustomMetrics {
       currentMetricsValues: Seq[CustomTaskMetric],
       customMetrics: Map[String, SQLMetric]): Unit = {
     currentMetricsValues.foreach { metric =>
-      customMetrics.get(metric.name()).map(_.set(metric.value()))
+      val metricName = metric.name()
+      val metricValue = metric.value()
+      customMetrics.get(metricName).map(_.set(metricValue))
+
+      if (builtInOutputMetrics.contains(metricName)) {
+        Option(TaskContext.get()).map(_.taskMetrics().outputMetrics).foreach { outputMetrics =>
+          metricName match {
+            case "bytesWritten" => outputMetrics.setBytesWritten(metricValue)
+            case "recordsWritten" => outputMetrics.setRecordsWritten(metricValue)

Review comment:
       It will break Scala 2.13. We need to handle all cases exhaustively from Scala 2.13+. Could you add the default case?




-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org