Github user kayousterhout commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9117#discussion_r43668740
  
    --- Diff: core/src/main/scala/org/apache/spark/ui/jobs/StagePage.scala ---
    @@ -122,6 +123,24 @@ private[ui] class StagePage(parent: StagesTab) extends 
WebUIPage("stage") {
           val externalAccumulables = allAccumulables.values.filter { acc => 
!acc.internal }
           val hasAccumulators = externalAccumulables.size > 0
     
    +      val tasksLocality = new mutable.HashMap[String, Long]
    +      if (stageData.taskData.size > 0) {
    +        for ((key, value) <- stageData.taskData) {
    +          val locality = value.taskInfo.taskLocality.toString;
    +          if (tasksLocality.contains(locality)) {
    +            val count: Long = tasksLocality.get(locality).get + 1;
    +            tasksLocality.put(locality, count);
    +          } else {
    +            tasksLocality.put(locality, 1);
    +          }
    +        }
    +      }
    +      var localityLevels: String = "";
    --- End diff --
    
    How about re-writing this as: (all of the concat statements are tough to 
read)
    
    tasksLocality.map { _ match {
      case (localityLevel, count) =>
        s"$localityLevel ($count)"
    }}.mkString("; ")


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to