venkata91 commented on a change in pull request #30164: URL: https://github.com/apache/spark/pull/30164#discussion_r517736090
########## File path: resource-managers/yarn/src/main/scala/org/apache/spark/scheduler/cluster/YarnSchedulerBackend.scala ########## @@ -161,6 +170,27 @@ private[spark] abstract class YarnSchedulerBackend( totalRegisteredExecutors.get() >= totalExpectedExecutors * minRegisteredRatio } + override def getMergerLocations( + numPartitions: Int, + resourceProfileId: Int): Seq[BlockManagerId] = { + // Currently this is naive way of calculating numMergersNeeded for a stage. In future, + // we can use better heuristics to calculate numMergersNeeded for a stage. + val tasksPerExecutor = sc.resourceProfileManager + .resourceProfileFromId(resourceProfileId).maxTasksPerExecutor(sc.conf) + val numMergersNeeded = math.min( + math.max(1, math.ceil(numPartitions / tasksPerExecutor).toInt), maxNumExecutors) + val minMergersThreshold = math.max(minMergersStaticThreshold, + math.floor(numMergersNeeded * minMergersThresholdRatio).toInt) Review comment: `minMergersThreshold` calculates mergers required both from `minMergersThresholdRatio` as well as the `minMergersStaticThreshold` - this doesn't consider `numMergersNeeded`. If `numMergersNeeded` < `minMergersThreshold` we would want to return the mergers obtained from `BlockManagerMaster`. Am I missing something here? ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org