J-HowHuang commented on code in PR #18433:
URL: https://github.com/apache/pinot/pull/18433#discussion_r3270988629


##########
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:
   Why are we changing this method? Are they not equivalent?
   Also if you're to change them I'd suggest to change the method 
`hasMultipleStreams` instead, so that this method is clear to return the 
original partition id whenever it has no multiple stream



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