Ngone51 commented on a change in pull request #31643:
URL: https://github.com/apache/spark/pull/31643#discussion_r585380050
##########
File path:
common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/OneForOneBlockFetcher.java
##########
@@ -138,9 +138,24 @@ private FetchShuffleBlocks createFetchShuffleBlocksMsg(
}
long[] mapIds = Longs.toArray(mapIdToReduceIds.keySet());
int[][] reduceIdArr = new int[mapIds.length][];
+ int blockIdIndex = 0;
for (int i = 0; i < mapIds.length; i++) {
reduceIdArr[i] = Ints.toArray(mapIdToReduceIds.get(mapIds[i]));
+ // The `blockIds`'s order must be same with the read order specified in
in FetchShuffleBlocks
+ // because the shuffle data's return order should match the `blockIds`'s
order to ensure
+ // blockId and data match.
+ if (!batchFetchEnabled) {
+ for (int j = 0; j < reduceIdArr[i].length; j++) {
+ this.blockIds[blockIdIndex++] = "shuffle_" + shuffleId + "_" +
mapIds[i] + "_"
+ + reduceIdArr[i][j];
Review comment:
I think my way is similar to @cloud-fan's in general, where both two
ways suggest using one map by storing the raw `blockId` together with splited
block id parts(the difference is whether it's parsed).
Besides, my way avoid introducing the new class `BlocksInfo` by reusing the
`blockIdParts` which is more efficient and simpler. And I don't see the
flexible requirements for this function now, we can add `BlocksInfo` whenever
we needs it.
@cloud-fan WDYT?
##########
File path:
common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/OneForOneBlockFetcher.java
##########
@@ -138,9 +138,24 @@ private FetchShuffleBlocks createFetchShuffleBlocksMsg(
}
long[] mapIds = Longs.toArray(mapIdToReduceIds.keySet());
int[][] reduceIdArr = new int[mapIds.length][];
+ int blockIdIndex = 0;
for (int i = 0; i < mapIds.length; i++) {
reduceIdArr[i] = Ints.toArray(mapIdToReduceIds.get(mapIds[i]));
+ // The `blockIds`'s order must be same with the read order specified in
in FetchShuffleBlocks
+ // because the shuffle data's return order should match the `blockIds`'s
order to ensure
+ // blockId and data match.
+ if (!batchFetchEnabled) {
+ for (int j = 0; j < reduceIdArr[i].length; j++) {
+ this.blockIds[blockIdIndex++] = "shuffle_" + shuffleId + "_" +
mapIds[i] + "_"
+ + reduceIdArr[i][j];
Review comment:
I think my way is similar to @cloud-fan's in general, where both two
ways suggest using one map by storing the raw `blockId` together with splited
block id parts(parsed or not).
Besides, my way avoid introducing the new class `BlocksInfo` by reusing the
`blockIdParts` which is more efficient and simpler. And I don't see the
flexible requirements for this function now, we can add `BlocksInfo` whenever
we needs it.
@cloud-fan WDYT?
----------------------------------------------------------------
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]