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

    https://github.com/apache/spark/pull/6652#discussion_r31975752
  
    --- Diff: core/src/main/scala/org/apache/spark/MapOutputTracker.scala ---
    @@ -284,6 +291,54 @@ private[spark] class MapOutputTrackerMaster(conf: 
SparkConf)
         cachedSerializedStatuses.contains(shuffleId) || 
mapStatuses.contains(shuffleId)
       }
     
    +  /**
    +   * Return a list of locations which have fraction of map output greater 
than specified threshold.
    +   *
    +   * @param shuffleId id of the shuffle
    +   * @param reducerId id of the reduce task
    +   * @param numReducers total number of reducers in the shuffle
    +   * @param fractionThreshold fraction of total map output size that a 
location must have
    +   *                          for it to be considered large.
    +   *
    +   * This method is not thread-safe
    +   */
    +  def getLocationsWithLargestOutputs(
    +      shuffleId: Int,
    +      reducerId: Int,
    +      numReducers: Int,
    +      fractionThreshold: Double)
    +    : Option[Array[BlockManagerId]] = {
    +
    +    if (mapStatuses.contains(shuffleId)) {
    +      // Pre-compute the top locations for each reducer and cache it
    +      val statuses = mapStatuses(shuffleId)
    +      if (statuses.nonEmpty) {
    +        // HashMap to add up sizes of all blocks at the same location
    +        val locs = new HashMap[BlockManagerId, Long]
    +        var totalOutputSize = 0L
    +        var mapIdx = 0
    +        while (mapIdx < statuses.length) {
    --- End diff --
    
    Good idea. Done


---
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