use of io.confluent.ksql.util.KsqlConstants.KsqlQueryStatus in project ksql by confluentinc.
the class ListQueriesExecutor method mergeExtended.
private static Map<QueryId, QueryDescription> mergeExtended(final Map<QueryId, QueryDescription> allResults, final Pair<Map<HostInfo, KsqlEntity>, Set<HostInfo>> remoteResults) {
final List<QueryDescription> remoteQueryDescriptions = remoteResults.getLeft().values().stream().map(QueryDescriptionList.class::cast).map(QueryDescriptionList::getQueryDescriptions).flatMap(List::stream).collect(Collectors.toList());
for (QueryDescription q : remoteQueryDescriptions) {
final QueryId queryId = q.getId();
// and the streams metadata task set
if (allResults.containsKey(queryId)) {
for (Map.Entry<KsqlHostInfoEntity, KsqlQueryStatus> entry : q.getKsqlHostQueryStatus().entrySet()) {
allResults.get(queryId).updateKsqlHostQueryStatus(entry.getKey(), entry.getValue());
}
allResults.get(queryId).updateTaskMetadata(q.getTasksMetadata());
} else {
allResults.put(queryId, q);
}
}
final Set<HostInfo> unresponsiveRemoteHosts = remoteResults.getRight();
for (HostInfo hostInfo : unresponsiveRemoteHosts) {
for (QueryDescription queryDescription : allResults.values()) {
queryDescription.updateKsqlHostQueryStatus(new KsqlHostInfoEntity(hostInfo.host(), hostInfo.port()), KsqlQueryStatus.UNRESPONSIVE);
}
}
return allResults;
}
Aggregations