shauryachats commented on code in PR #18433:
URL: https://github.com/apache/pinot/pull/18433#discussion_r3320778060


##########
pinot-spi/src/main/java/org/apache/pinot/spi/utils/IngestionConfigUtils.java:
##########
@@ -117,8 +117,19 @@ public static int 
getPinotPartitionIdFromStreamPartitionId(int partitionId, int
   }
 
   /// Returns the stream partition id from the Pinot segment partition id.
+  /// Safe to call for any table type: returns `partitionId` unchanged for 
OFFLINE tables or REALTIME tables
+  /// that lack stream configs (treat as single-stream).
   public static int getStreamPartitionIdFromPinotPartitionId(TableConfig 
tableConfig, int partitionId) {
-    return hasMultipleStreams(tableConfig) ? 
getStreamPartitionIdFromPinotPartitionId(partitionId) : partitionId;
+    if (tableConfig.getTableType() != TableType.REALTIME) {
+      return partitionId;
+    }
+    IngestionConfig ingestionConfig = tableConfig.getIngestionConfig();
+    if (ingestionConfig == null || ingestionConfig.getStreamIngestionConfig() 
== null) {
+      return partitionId;
+    }
+    List<Map<String, String>> streamConfigMaps = 
ingestionConfig.getStreamIngestionConfig().getStreamConfigMaps();
+    return streamConfigMaps != null && streamConfigMaps.size() > 1
+        ? getStreamPartitionIdFromPinotPartitionId(partitionId) : partitionId;

Review Comment:
   They were not equivalent for OFFLINE tables — the old hasMultipleStreams 
delegated to getStreamConfigMaps, which throws `IllegalStateException` for 
OFFLINE tables (it has a Preconditions.checkState on TableType.REALTIME). Since 
ReplicaGroupSegmentAssignmentStrategy calls this for both table types, the call 
would throw on OFFLINE tables. 
   
   Agreed with your suggestion:  Fixed hasMultipleStreams to safely return 
false for OFFLINE tables and null
    ingestionConfig.



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