Jackie-Jiang commented on code in PR #15725: URL: https://github.com/apache/pinot/pull/15725#discussion_r2098970574
########## pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/TableViews.java: ########## @@ -141,28 +146,44 @@ public TableView getExternalView( public String getSegmentsStatusDetails( @ApiParam(value = "Name of the table", required = true) @PathParam("tableName") String tableName, @ApiParam(value = "realtime|offline", required = false) @QueryParam("tableType") String tableTypeStr, + @ApiParam(value = "Show segments being replaced: true|false", required = false) Review Comment: (minor) For consistency ```suggestion @ApiParam(value = "Include replaced segments", required = false) ``` ########## pinot-controller/src/main/java/org/apache/pinot/controller/util/TableSizeReader.java: ########## @@ -259,6 +264,10 @@ public TableSubTypeSizeDetails getTableSubtypeSize(String tableNameWithType, int String server = entry.getKey(); List<SegmentSizeInfo> segmentSizeInfoList = serverToSegmentSizeInfoListMap.get(server); if (segmentSizeInfoList != null) { + segmentSizeInfoList = serverToSegmentSizeInfoListMap.get(server) + .stream() + .filter(segmentSizeInfo -> entry.getValue().contains(segmentSizeInfo.getSegmentName())) + .collect(Collectors.toList()); Review Comment: Currently this filtering logic is very inefficient because you are doing `contains` with a `List`. Given we need to filter anyway, we can optimize it by: 1. Create a map from segment name to segment size from `segmentSizeInfoList` 2. Loop over the `segments` (`entry.getValue()`), check if segment is available from the map You may also remove the TODO on line 262 after making this change -- 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