mridulm commented on a change in pull request #34156:
URL: https://github.com/apache/spark/pull/34156#discussion_r720677576
##########
File path:
core/src/main/scala/org/apache/spark/shuffle/sort/SortShuffleManager.scala
##########
@@ -129,11 +129,20 @@ private[spark] class SortShuffleManager(conf: SparkConf)
extends ShuffleManager
endPartition: Int,
context: TaskContext,
metrics: ShuffleReadMetricsReporter): ShuffleReader[K, C] = {
- val blocksByAddress =
SparkEnv.get.mapOutputTracker.getMapSizesByExecutorId(
- handle.shuffleId, startMapIndex, endMapIndex, startPartition,
endPartition)
+ val baseShuffleHandle = handle.asInstanceOf[BaseShuffleHandle[K, _, C]]
+ val (blocksByAddress, enableBatchFetch) =
+ if (baseShuffleHandle.dependency.shuffleMergeEnabled) {
+ val res =
SparkEnv.get.mapOutputTracker.getPushBasedShuffleMapSizesByExecutorId(
+ handle.shuffleId, startMapIndex, endMapIndex, startPartition,
endPartition)
+ (res.iter, res.enableBatchFetch)
+ } else {
+ val address = SparkEnv.get.mapOutputTracker.getMapSizesByExecutorId(
+ handle.shuffleId, startMapIndex, endMapIndex, startPartition,
endPartition)
+ (address, canUseBatchFetch(startPartition, endPartition, context))
+ }
new BlockStoreShuffleReader(
handle.asInstanceOf[BaseShuffleHandle[K, _, C]], blocksByAddress,
context, metrics,
- shouldBatchFetch = canUseBatchFetch(startPartition, endPartition,
context))
+ shouldBatchFetch = enableBatchFetch)
}
Review comment:
nit: Cleaner would be:
* rename `enableBatchFetch` to `canEnableBatchFetch`.
* Set to `true` in else block and `res.enableBatchFetch` in `if` block
* here, do: `shouldBatchFetch = canEnableBatchFetch &&
canUseBatchFetch(startPartition, endPartition, context)`
--
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]