You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@celeborn.apache.org by GitBox <gi...@apache.org> on 2022/11/28 03:34:14 UTC

[GitHub] [incubator-celeborn] waitinfuture commented on a diff in pull request #997: [CELEBORN-18] Refactor stream manager to distinguish map partition and reduce partition.

waitinfuture commented on code in PR #997:
URL: https://github.com/apache/incubator-celeborn/pull/997#discussion_r1033088713


##########
common/src/main/java/org/apache/celeborn/common/meta/FileInfo.java:
##########
@@ -28,32 +28,53 @@
 import org.apache.hadoop.fs.Path;
 
 import org.apache.celeborn.common.identity.UserIdentifier;
+import org.apache.celeborn.common.protocol.PartitionType;
 import org.apache.celeborn.common.util.Utils;
 
 public class FileInfo {
   private final String filePath;
   private final List<Long> chunkOffsets;
   private final UserIdentifier userIdentifier;
+  private final PartitionType partitionType;
 
   public FileInfo(String filePath, List<Long> chunkOffsets, UserIdentifier userIdentifier) {
+    this(filePath, chunkOffsets, userIdentifier, PartitionType.REDUCE);
+  }
+
+  public FileInfo(
+      String filePath,
+      List<Long> chunkOffsets,
+      UserIdentifier userIdentifier,
+      PartitionType partitionType) {
     this.filePath = filePath;
     this.chunkOffsets = chunkOffsets;
     this.userIdentifier = userIdentifier;
+    this.partitionType = partitionType;
   }
 
-  public FileInfo(String filePath, UserIdentifier userIdentifier) {
-    this.filePath = filePath;
-    this.chunkOffsets = new ArrayList<>();
-    chunkOffsets.add(0L);
-    this.userIdentifier = userIdentifier;
+  public FileInfo(String filePath, UserIdentifier userIdentifier, PartitionType partitionType) {
+    this(
+        filePath,
+        new ArrayList() {

Review Comment:
   Better to use one line for the new ArrayList



##########
common/src/main/java/org/apache/celeborn/common/meta/FileInfo.java:
##########
@@ -28,32 +28,53 @@
 import org.apache.hadoop.fs.Path;
 
 import org.apache.celeborn.common.identity.UserIdentifier;
+import org.apache.celeborn.common.protocol.PartitionType;
 import org.apache.celeborn.common.util.Utils;
 
 public class FileInfo {
   private final String filePath;
   private final List<Long> chunkOffsets;
   private final UserIdentifier userIdentifier;
+  private final PartitionType partitionType;
 
   public FileInfo(String filePath, List<Long> chunkOffsets, UserIdentifier userIdentifier) {
+    this(filePath, chunkOffsets, userIdentifier, PartitionType.REDUCE);
+  }
+
+  public FileInfo(
+      String filePath,
+      List<Long> chunkOffsets,
+      UserIdentifier userIdentifier,
+      PartitionType partitionType) {
     this.filePath = filePath;
     this.chunkOffsets = chunkOffsets;
     this.userIdentifier = userIdentifier;
+    this.partitionType = partitionType;
   }
 
-  public FileInfo(String filePath, UserIdentifier userIdentifier) {
-    this.filePath = filePath;
-    this.chunkOffsets = new ArrayList<>();
-    chunkOffsets.add(0L);
-    this.userIdentifier = userIdentifier;
+  public FileInfo(String filePath, UserIdentifier userIdentifier, PartitionType partitionType) {
+    this(
+        filePath,
+        new ArrayList() {
+          {
+            add(0L);
+          }
+        },
+        userIdentifier,
+        PartitionType.REDUCE);

Review Comment:
   partitionType



##########
common/src/main/java/org/apache/celeborn/common/meta/FileInfo.java:
##########
@@ -28,32 +28,53 @@
 import org.apache.hadoop.fs.Path;
 
 import org.apache.celeborn.common.identity.UserIdentifier;
+import org.apache.celeborn.common.protocol.PartitionType;
 import org.apache.celeborn.common.util.Utils;
 
 public class FileInfo {
   private final String filePath;
   private final List<Long> chunkOffsets;
   private final UserIdentifier userIdentifier;
+  private final PartitionType partitionType;
 
   public FileInfo(String filePath, List<Long> chunkOffsets, UserIdentifier userIdentifier) {
+    this(filePath, chunkOffsets, userIdentifier, PartitionType.REDUCE);
+  }
+
+  public FileInfo(
+      String filePath,
+      List<Long> chunkOffsets,
+      UserIdentifier userIdentifier,
+      PartitionType partitionType) {
     this.filePath = filePath;
     this.chunkOffsets = chunkOffsets;
     this.userIdentifier = userIdentifier;
+    this.partitionType = partitionType;
   }
 
-  public FileInfo(String filePath, UserIdentifier userIdentifier) {
-    this.filePath = filePath;
-    this.chunkOffsets = new ArrayList<>();
-    chunkOffsets.add(0L);
-    this.userIdentifier = userIdentifier;
+  public FileInfo(String filePath, UserIdentifier userIdentifier, PartitionType partitionType) {
+    this(
+        filePath,
+        new ArrayList() {
+          {
+            add(0L);
+          }
+        },
+        userIdentifier,
+        PartitionType.REDUCE);
   }
 
   @VisibleForTesting
   public FileInfo(File file, UserIdentifier userIdentifier) {
-    this.filePath = file.getAbsolutePath();
-    this.chunkOffsets = new ArrayList<>();
-    chunkOffsets.add(0L);
-    this.userIdentifier = userIdentifier;
+    this(
+        file.getAbsolutePath(),
+        new ArrayList() {

Review Comment:
   ditto



-- 
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: dev-unsubscribe@celeborn.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org