Github user jiangxb1987 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18231#discussion_r122225726
  
    --- Diff: 
common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleBlockHandler.java
 ---
    @@ -209,4 +190,51 @@ private ShuffleMetrics() {
         }
       }
     
    +  private class ManagedBufferIterator implements Iterator<ManagedBuffer> {
    +
    +    private int index = 0;
    +    private final String appId;
    +    private final String execId;
    +    private final int shuffleId;
    +    // An array containing mapId and reduceId pairs.
    +    private final int[] mapIdAndReduceIds;
    +
    +    ManagedBufferIterator(String appId, String execId, String[] blockIds) {
    +      this.appId = appId;
    +      this.execId = execId;
    +      String[] blockId0Parts = blockIds[0].split("_");
    +      if (blockId0Parts.length < 4) {
    +        throw new IllegalArgumentException("Unexpected block id format: " 
+ blockIds[0]);
    +      }
    +      if (!blockId0Parts[0].equals("shuffle")) {
    +        throw new IllegalArgumentException("Expected shuffle block id, 
got: " + blockIds[0]);
    +      }
    +      this.shuffleId = Integer.parseInt(blockId0Parts[1]);
    +      mapIdAndReduceIds = new int[2 * blockIds.length];
    +      for (int i = 0; i < blockIds.length; i++) {
    +        String[] blockIdParts = blockIds[i].split("_");
    +        if (Integer.parseInt(blockIdParts[1]) != shuffleId) {
    --- End diff --
    
    blockIdParts[1].toInt != shuffleId ?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to