yuanbenson commented on code in PR #9309:
URL: https://github.com/apache/pinot/pull/9309#discussion_r964221907


##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/assignment/segment/OfflineSegmentAssignment.java:
##########
@@ -52,63 +55,55 @@ protected int getReplication(TableConfig tableConfig) {
   @Override
   public List<String> assignSegment(String segmentName, Map<String, 
Map<String, String>> currentAssignment,
       Map<InstancePartitionsType, InstancePartitions> instancePartitionsMap) {
+    SegmentAssignmentStrategy segmentAssignmentStrategy = 
_assignmentStrategyMap.get(InstancePartitionsType.OFFLINE);
+    // Need to check assignmentStrategy for Dim Tables as following pre 
conditions state would return false
+    if (segmentAssignmentStrategy instanceof 
DimTableSegmentAssignmentStrategy) {
+      return segmentAssignmentStrategy.assignSegment(segmentName,
+          currentAssignment, null, InstancePartitionsType.OFFLINE);
+    }
     InstancePartitions instancePartitions = 
instancePartitionsMap.get(InstancePartitionsType.OFFLINE);
     Preconditions.checkState(instancePartitions != null, "Failed to find 
OFFLINE instance partitions for table: %s",
         _tableNameWithType);

Review Comment:
   ```suggestion
       InstancePartitions instancePartitions = 
instancePartitionsMap.get(InstancePartitionsType.OFFLINE);
       Preconditions.checkState(
           !(segmentAssignmentStrategy instanceof 
DimTableSegmentAssignmentStrategy) && instancePartitions != null,
           "Failed to find OFFLINE instance partitions for table: %s", 
_tableNameWithType);
   ```
   One way of rewriting to not bypass the logging below and avoid calling 
`segmentAssignmentStrategy.reassignSegments` directly, or move 
`instancePartitions != null` into `validateSegmentAssignmentStrategy`.



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