xiangfu0 commented on code in PR #19958:
URL: https://github.com/apache/pinot/pull/19958#discussion_r4329929547


##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/utils/TableConfigUtils.java:
##########
@@ -1448,6 +1515,37 @@ static void 
validateInstanceAssignmentConfigs(TableConfig tableConfig) {
             "numInstancesPerPartition must be 1 when using 
IMPLICIT_REALTIME_TABLE_PARTITION_SELECTOR");
       }
       // TODO: Add more validations for other partition selectors here
+
+      // Partition based placement of OFFLINE segments reads the partition of 
a segment from its metadata
+      InstanceReplicaGroupPartitionConfig replicaGroupPartitionConfig =
+          instanceAssignmentConfig.getReplicaGroupPartitionConfig();
+      if (offlineSegmentKeys.contains(instancePartitionsType) && 
replicaGroupPartitionConfig.isReplicaGroupBased()
+          && replicaGroupPartitionConfig.getNumPartitions() > 1) {
+        validateSegmentAssignmentPartitionColumn(tableConfig);
+      }
+    }
+  }
+
+  /// Validates that the partition column for partition based placement of 
OFFLINE segments can be resolved, which
+  /// is required when the instance partitions placing them, the OFFLINE ones 
or those of a tier of an OFFLINE table,
+  /// have multiple partitions. The partition column configured for segment 
assignment must be a column of the
+  /// segment partition config; without a configured column the segment 
partition config must have exactly one
+  /// column, which is how the partition id of a segment is read from its 
metadata. The OFFLINE instance partitions
+  /// may also be pre-configured, in which case the controller runs this 
validation on the fetched ones.
+  public static void validateSegmentAssignmentPartitionColumn(TableConfig 
tableConfig) {
+    Map<String, ColumnPartitionConfig> columnPartitionMap = 
getColumnPartitionMap(tableConfig);
+    Preconditions.checkState(!columnPartitionMap.isEmpty(),

Review Comment:
   test



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to