Github user squito commented on a diff in the pull request: https://github.com/apache/spark/pull/22612#discussion_r232224322 --- Diff: core/src/main/scala/org/apache/spark/metrics/ExecutorMetricType.scala --- @@ -95,10 +148,18 @@ private[spark] object ExecutorMetricType { OnHeapUnifiedMemory, OffHeapUnifiedMemory, DirectPoolMemory, - MappedPoolMemory + MappedPoolMemory, + ProcessTreeMetrics ) - // Map of executor metric type to its index in values. - val metricIdxMap = - Map[ExecutorMetricType, Int](ExecutorMetricType.values.zipWithIndex: _*) + var definedMetricsAndOffset = mutable.LinkedHashMap.empty[String, Int] + var numberOfMetrics = 0 --- End diff -- you only need this mutable during initialization, so to convey its eventually final value, you can move the mutability to inside a block: ```scala val (metricToOffset, numMetrics) = { var n = 0 val _metricToOffset = mutable.LinkedHashMap.empty[String, Int] ... (_metricToOffset, n) } ```
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org