Copilot commented on code in PR #16776:
URL: https://github.com/apache/pinot/pull/16776#discussion_r2331422385


##########
pinot-spi/src/main/java/org/apache/pinot/spi/config/table/ColumnPartitionConfig.java:
##########
@@ -30,20 +30,29 @@ public class ColumnPartitionConfig extends BaseJsonConfig {
   private final String _functionName;
   private final int _numPartitions;
   private final Map<String, String> _functionConfig;
+  private final boolean _allowPartitionRemapping;
 
   public ColumnPartitionConfig(String functionName, int numPartitions) {
-    this(functionName, numPartitions, null);
+    this(functionName, numPartitions, null, false);
   }
 
-  @JsonCreator
   public ColumnPartitionConfig(@JsonProperty(value = "functionName", required 
= true) String functionName,
       @JsonProperty(value = "numPartitions", required = true) int 
numPartitions,
       @JsonProperty(value = "functionConfig") @Nullable Map<String, String> 
functionConfig) {

Review Comment:
   The @JsonCreator annotation should be moved from the removed 3-parameter 
constructor to the new 4-parameter constructor at line 45 to maintain proper 
JSON deserialization support.



##########
pinot-broker/src/main/java/org/apache/pinot/broker/routing/segmentpartition/SegmentPartitionMetadataManager.java:
##########
@@ -106,14 +108,25 @@ private int getPartitionId(String segment, @Nullable 
ZNRecord znRecord) {
     if (!_partitionFunctionName.equalsIgnoreCase(partitionFunction.getName())) 
{
       return INVALID_PARTITION_ID;
     }
-    if (_numPartitions != partitionFunction.getNumPartitions()) {
-      return INVALID_PARTITION_ID;
-    }
-    Set<Integer> partitions = segmentPartitionInfo.getPartitions();
-    if (partitions.size() != 1) {
-      return INVALID_PARTITION_ID;
+    if (_allowPartitionRemapping) {
+      if (partitionFunction.getNumPartitions() % _numPartitions != 0) {
+        return INVALID_PARTITION_ID;
+      }

Review Comment:
   The partition remapping logic should include a comment explaining the modulo 
validation requirement. This ensures readers understand why divisibility is 
enforced (e.g., 'Ensure segment partitions can be evenly distributed across 
table partitions').



-- 
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