deepthi912 commented on code in PR #13296: URL: https://github.com/apache/pinot/pull/13296#discussion_r1708168968
########## pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotSegmentRestletResource.java: ########## @@ -230,25 +231,54 @@ public List<Map<TableType, List<String>>> getSegments( @Path("segments/{tableName}/servers") @Authorize(targetType = TargetType.TABLE, paramName = "tableName", action = Actions.Table.GET_SERVER_MAP) @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Get a map from server to segments hosted by the server", - notes = "Get a map from server to segments hosted by the server") + @ApiOperation(value = "Get a map from server to segments hosted by the server", notes = "Get a map from server to " + + "segments hosted by the server") public List<Map<String, Object>> getServerToSegmentsMap( @ApiParam(value = "Name of the table", required = true) @PathParam("tableName") String tableName, - @ApiParam(value = "OFFLINE|REALTIME") @QueryParam("type") String tableTypeStr, @Context HttpHeaders headers) { + @ApiParam(value = "OFFLINE|REALTIME") @QueryParam("type") String tableTypeStr, + @QueryParam("detailed") @DefaultValue("true") boolean detailed, @Context HttpHeaders headers) { tableName = DatabaseUtils.translateTableName(tableName, headers); - List<String> tableNamesWithType = ResourceUtils - .getExistingTableNamesWithType(_pinotHelixResourceManager, tableName, Constants.validateTableType(tableTypeStr), - LOGGER); + List<String> tableNamesWithType = ResourceUtils.getExistingTableNamesWithType(_pinotHelixResourceManager, tableName, + Constants.validateTableType(tableTypeStr), LOGGER); List<Map<String, Object>> resultList = new ArrayList<>(tableNamesWithType.size()); for (String tableNameWithType : tableNamesWithType) { Map<String, Object> resultForTable = new LinkedHashMap<>(); resultForTable.put("tableName", tableNameWithType); - resultForTable.put("serverToSegmentsMap", _pinotHelixResourceManager.getServerToSegmentsMap(tableNameWithType)); + if (detailed) { + resultForTable.put("serverToSegmentsMap", _pinotHelixResourceManager.getServerToSegmentsMap(tableNameWithType)); + } else { + resultForTable.put("serverToSegmentsCountMap", + _pinotHelixResourceManager.getServerToSegmentsCountMap(tableNameWithType)); Review Comment: Updated the count map as well in the non-detailed response but I think using _pinotHelixResourceManager.getServerToSegmentsMap will again be a heavy task for the non-detailed response which is not needed. So wrote a separate function for the serverToSegmentsCountMap. -- 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