Jackie-Jiang commented on code in PR #15817: URL: https://github.com/apache/pinot/pull/15817#discussion_r2093793828
########## pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/assignment/segment/SegmentAssignmentUtils.java: ########## @@ -439,6 +440,29 @@ public Map<String, Map<String, String>> getNonTierSegmentAssignment() { } } + /** + * Return the partitionId for an OFFLINE or REALTIME table + */ + public static int getPartitionId(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. Use the same logic to calculate the + // partitionId if partitionColumn or calculated partitionId is null for OFFLINE and REALTIME tables + if (tableType == TableType.OFFLINE) { + partitionId = partitionColumn == null ? getDefaultPartitionId(segmentName) Review Comment: Is this correct? I think you want to always `% numPartitions` ########## pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/assignment/segment/SegmentAssignmentUtils.java: ########## @@ -448,10 +472,10 @@ public static int getOfflineSegmentPartitionId(String segmentName, String offlin ZKMetadataProvider.getSegmentZKMetadata(helixManager.getHelixPropertyStore(), offlineTableName, segmentName); Preconditions.checkState(segmentZKMetadata != null, "Failed to find segment ZK metadata for segment: %s of table: %s", segmentName, offlineTableName); - return getPartitionId(segmentZKMetadata, offlineTableName, partitionColumn); + return getOfflinePartitionId(segmentZKMetadata, offlineTableName, partitionColumn); } - private static int getPartitionId(SegmentZKMetadata segmentZKMetadata, String offlineTableName, + private static int getOfflinePartitionId(SegmentZKMetadata segmentZKMetadata, String offlineTableName, @Nullable String partitionColumn) { Review Comment: Not introduced in this PR, but this doesn't seem correct. Seems like `partitionColumn` cannot be null here, or it will guaranteed to fail. -- 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