J-HowHuang commented on code in PR #16136: URL: https://github.com/apache/pinot/pull/16136#discussion_r2159769400
########## pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/rebalance/tenant/TenantRebalanceResult.java: ########## @@ -50,10 +87,123 @@ public TenantRebalanceResult(String jobId, Map<String, RebalanceResult> rebalanc } } + private void computeStatusSummary(Map<String, RebalanceResult> rebalanceTableResults) { + _statusSummary = new HashMap<>(); + for (RebalanceResult result : rebalanceTableResults.values()) { + RebalanceResult.Status status = result.getStatus(); + _statusSummary.put(status, _statusSummary.getOrDefault(status, 0) + 1); + } + } + + private void computeAggregatedPreChecks(Map<String, RebalanceResult> rebalanceTableResults) { + _aggregatedPreChecksResult = new HashMap<>(); + + // Organize pre-check results by pre-check name + Map<String, Map<String, String>> passedTablesByCheck = new HashMap<>(); + Map<String, Map<String, String>> warnedTablesByCheck = new HashMap<>(); + Map<String, Map<String, String>> erroredTablesByCheck = new HashMap<>(); + + // Process each table's pre-check results + for (Map.Entry<String, RebalanceResult> entry : rebalanceTableResults.entrySet()) { + String tableName = entry.getKey(); + RebalanceResult result = entry.getValue(); + + if (result.getPreChecksResult() != null) { + for (Map.Entry<String, RebalancePreCheckerResult> checkEntry : result.getPreChecksResult().entrySet()) { + String checkName = checkEntry.getKey(); + RebalancePreCheckerResult checkResult = checkEntry.getValue(); + + // Initialize maps for this check if not present + passedTablesByCheck.computeIfAbsent(checkName, k -> new HashMap<>()); + warnedTablesByCheck.computeIfAbsent(checkName, k -> new HashMap<>()); + erroredTablesByCheck.computeIfAbsent(checkName, k -> new HashMap<>()); Review Comment: For each check it has to initialize an empty map even if there's no error table (same as pass, warn), so I'll just initialize it at the beginning -- 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