tableAccessInfo.getOperatorToTableAccessMap() == null ||
tableAccessInfo.getOperatorToTableAccessMap().isEmpty()) {
return;
}
LogHelper console = SessionState.getConsole();
Map<Operator<? extends OperatorDesc>, Map<String, List<String>>> operatorToTableAccessMap =
tableAccessInfo.getOperatorToTableAccessMap();
// We need a new map to ensure output is always produced in the same order.
// This makes tests that use this hook deterministic.
Map<String, String> outputOrderedMap = new HashMap<String, String>();
for (Map.Entry<Operator<? extends OperatorDesc>, Map<String, List<String>>> tableAccess:
operatorToTableAccessMap.entrySet()) {
StringBuilder perOperatorInfo = new StringBuilder();
perOperatorInfo.append("Operator:").append(tableAccess.getKey().getOperatorId())
.append("\n");
for (Map.Entry<String, List<String>> entry: tableAccess.getValue().entrySet()) {
perOperatorInfo.append("Table:").append(entry.getKey()).append("\n");
perOperatorInfo.append("Keys:").append(StringUtils.join(entry.getValue(), ','))
.append("\n");
}
outputOrderedMap.put(tableAccess.getKey().getOperatorId(), perOperatorInfo.toString());
}
for (String perOperatorInfo: outputOrderedMap.values()) {
console.printError(perOperatorInfo);
}
}