J-HowHuang commented on code in PR #16136: URL: https://github.com/apache/pinot/pull/16136#discussion_r2175624787
########## 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<>()); + + // Categorize table based on this specific check's status + String message = checkResult.getMessage() != null ? checkResult.getMessage() : ""; + switch (checkResult.getPreCheckStatus()) { + case PASS: + passedTablesByCheck.get(checkName).put(tableName, message); + break; + case WARN: + warnedTablesByCheck.get(checkName).put(tableName, message); + break; + case ERROR: + erroredTablesByCheck.get(checkName).put(tableName, message); + break; + default: + break; // Ignore unknown statuses Review Comment: Sorry, somehow overlooked this. Added the log -- 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