luoyuqinlaura commented on code in PR #59966:
URL: https://github.com/apache/spark/pull/59966#discussion_r4647383192
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/ui/SQLAppStatusListener.scala:
##########
@@ -275,25 +275,27 @@ class SQLAppStatusListener(
maxMetricsFromAllStages(id) = updated
}
- exec.driverAccumUpdates.foreach { case (id, value) =>
- if (accumIds.contains(id)) {
+ // Group updates by accumulator id so that each id is appended once,
+ // avoiding repeated array copies.
+ exec.driverAccumUpdates
+ .filter { case (id, _) => accumIds.contains(id) }
+ .groupBy(_._1)
+ .foreach { case (id, updatesForId) =>
+ val values = updatesForId.map(_._2)
val prev = allMetrics.getOrElse(id, null)
- val updated = if (prev != null) {
+ if (prev != null) {
Review Comment:
Done, the check now runs whenever maxMetricsFromAllStages holds the id,
before choosing how to merge, as suggested.
--
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]