cloud-fan commented on a change in pull request #28301:
URL: https://github.com/apache/spark/pull/28301#discussion_r414369986
##########
File path:
core/src/test/scala/org/apache/spark/storage/ShuffleBlockFetcherIteratorSuite.scala
##########
@@ -1071,4 +1072,43 @@ class ShuffleBlockFetcherIteratorSuite extends
SparkFunSuite with PrivateMethodT
val e = intercept[FetchFailedException] { iterator.next() }
assert(e.getMessage.contains("Received a zero-size buffer"))
}
+
+ test("SPARK-31521: correct the fetch size when merging blocks into a merged
block") {
+ val bId1 = ShuffleBlockBatchId(0, 0, 0, 5)
+ val bId2 = ShuffleBlockId(0, 0, 6)
+ val bId3 = ShuffleBlockId(0, 0, 7)
+ val block1 = FetchBlockInfo(bId1, 40, 0)
+ val block2 = FetchBlockInfo(bId2, 50, 0)
+ val block3 = FetchBlockInfo(bId3, 60, 0)
+ val inputBlocks = Seq(block1, block2, block3)
+
+ val blockManager = mock(classOf[BlockManager])
+ val localBmId = BlockManagerId("test-client", "test-client", 1)
+ val taskContext = TaskContext.empty()
+ doReturn(localBmId).when(blockManager).blockManagerId
+ val iterator = new ShuffleBlockFetcherIterator(
+ taskContext,
+ createMockTransfer(Map.empty),
+ blockManager,
+ Iterator.empty,
+ (_, in) => in,
+ 48 * 1024 * 1024,
+ Int.MaxValue,
+ Int.MaxValue,
+ Int.MaxValue,
+ true,
+ false,
+ taskContext.taskMetrics.createTempShuffleReadMetrics(),
+ true)
+
+ val mergeMethod =
+
PrivateMethod[Seq[FetchBlockInfo]](Symbol("mergeContinuousShuffleBlockIdsIfNeeded"))
Review comment:
shall we move this method to `object ShuffleBlockFetcherIterator` so
it's easier to test?
----------------------------------------------------------------
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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]