somandal commented on code in PR #15817:
URL: https://github.com/apache/pinot/pull/15817#discussion_r2116355314


##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/assignment/segment/SegmentAssignmentUtils.java:
##########
@@ -439,21 +441,66 @@ public Map<String, Map<String, String>> 
getNonTierSegmentAssignment() {
     }
   }
 
+  /**
+   * Return the partitionId for an OFFLINE or COMPLETED instance partitions of 
a REALTIME table with relocation enabled
+   * The partitionId will be calculated as:
+   * <ul>
+   *   <li>
+   *     1. If numPartitions = 1, return partitionId = 0
+   *   </li>
+   *   <li>
+   *     2. Otherwise, fallback to either the OFFLINE or REALTIME partitionId 
calculation logic
+   *   </li>
+   * </ul>
+   */
+  public static int getOfflineOrCompletedPartitionId(String segmentName, 
String tableName, TableType tableType,
+      HelixManager helixManager, int numPartitions, @Nullable String 
partitionColumn) {
+    int partitionId;
+    if (numPartitions == 1) {
+      partitionId = 0;
+    } else {
+      // Uniformly spray the segment partitions over the instance partitions
+      if (tableType == TableType.OFFLINE) {
+        partitionId = SegmentAssignmentUtils
+                .getOfflineSegmentPartitionId(segmentName, tableName, 
helixManager, partitionColumn);

Review Comment:
   done



-- 
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: commits-unsubscr...@pinot.apache.org

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


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

Reply via email to