use of io.trino.operator.DirectExchangeClient in project trino by trinodb.
the class Query method create.
public static Query create(Session session, Slug slug, QueryManager queryManager, Optional<URI> queryInfoUrl, DirectExchangeClientSupplier directExchangeClientSupplier, Executor dataProcessorExecutor, ScheduledExecutorService timeoutExecutor, BlockEncodingSerde blockEncodingSerde) {
DirectExchangeClient exchangeClient = directExchangeClientSupplier.get(session.getQueryId(), new ExchangeId("direct-exchange-query-results"), new SimpleLocalMemoryContext(newSimpleAggregatedMemoryContext(), Query.class.getSimpleName()), queryManager::outputTaskFailed, getRetryPolicy(session));
Query result = new Query(session, slug, queryManager, queryInfoUrl, exchangeClient, dataProcessorExecutor, timeoutExecutor, blockEncodingSerde);
result.queryManager.addOutputInfoListener(result.getQueryId(), result::setQueryOutputInfo);
result.queryManager.addStateChangeListener(result.getQueryId(), state -> {
if (state.isDone()) {
QueryInfo queryInfo = queryManager.getFullQueryInfo(result.getQueryId());
result.closeExchangeClientIfNecessary(queryInfo);
}
});
return result;
}
Aggregations