You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/04/22 16:16:53 UTC
[GitHub] [spark] dongjoon-hyun commented on a change in pull request #28301: [SPARK-31521][CORE] Correct the fetch size when merging blocks into a merged block
dongjoon-hyun commented on a change in pull request #28301:
URL: https://github.com/apache/spark/pull/28301#discussion_r413121924
##########
File path: core/src/main/scala/org/apache/spark/storage/ShuffleBlockFetcherIterator.scala
##########
@@ -414,21 +414,23 @@ final class ShuffleBlockFetcherIterator(
def shouldMergeIntoPreviousBatchBlockId =
mergedBlockInfo.last.blockId.asInstanceOf[ShuffleBlockBatchId].mapId == startBlockId.mapId
- val startReduceId = if (mergedBlockInfo.nonEmpty && shouldMergeIntoPreviousBatchBlockId) {
- // Remove the previous batch block id as we will add a new one to replace it.
- mergedBlockInfo.remove(mergedBlockInfo.length - 1).blockId
- .asInstanceOf[ShuffleBlockBatchId].startReduceId
- } else {
- startBlockId.reduceId
- }
+ val (startReduceId, size) =
+ if (mergedBlockInfo.nonEmpty && shouldMergeIntoPreviousBatchBlockId) {
+ // Remove the previous batch block id as we will add a new one to replace it.
+ val removed = mergedBlockInfo.remove(mergedBlockInfo.length - 1)
+ (removed.blockId.asInstanceOf[ShuffleBlockBatchId].startReduceId,
+ removed.size + toBeMerged.map(_.size).sum)
+ } else {
+ (startBlockId.reduceId, toBeMerged.map(_.size).sum)
+ }
Review comment:
@Ngone51 . Could you make a unit test for this bug?
----------------------------------------------------------------
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:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org