luoyuqinlaura commented on code in PR #59966:
URL: https://github.com/apache/spark/pull/59966#discussion_r4647447436
##########
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)
Review Comment:
I kept groupBy for readability. It is a single pass over the entries, and
the 1M-entry replay above takes about 1.1 s
--
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]