Search in sources :

Example 1 with DirectExchangeClient

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;
}
Also used : SimpleLocalMemoryContext(io.trino.memory.context.SimpleLocalMemoryContext) DirectExchangeClient(io.trino.operator.DirectExchangeClient) QueryInfo(io.trino.execution.QueryInfo) ExchangeId(io.trino.spi.exchange.ExchangeId)

Aggregations

QueryInfo (io.trino.execution.QueryInfo)1 SimpleLocalMemoryContext (io.trino.memory.context.SimpleLocalMemoryContext)1 DirectExchangeClient (io.trino.operator.DirectExchangeClient)1 ExchangeId (io.trino.spi.exchange.ExchangeId)1