use of io.prestosql.execution.QueryStateMachine in project hetu-core by openlookeng.
the class SqlQueryScheduler method updateQueryOutputLocations.
private static void updateQueryOutputLocations(QueryStateMachine queryStateMachine, OutputBufferId rootBufferId, Set<RemoteTask> tasks, boolean noMoreExchangeLocations) {
Set<TaskLocation> bufferLocations = tasks.stream().map(task -> {
URI uri = task.getTaskStatus().getSelf();
String instanceId = task.getInstanceId();
URI newUri = uriBuilderFrom(uri).appendPath("results").appendPath(rootBufferId.toString()).build();
return new TaskLocation(newUri, instanceId);
}).collect(toImmutableSet());
queryStateMachine.updateOutputLocations(bufferLocations, noMoreExchangeLocations);
}
use of io.prestosql.execution.QueryStateMachine in project hetu-core by openlookeng.
the class LocalDispatchQueryFactory method createDispatchQuery.
@Override
public DispatchQuery createDispatchQuery(Session session, String query, PreparedQuery preparedQuery, String slug, ResourceGroupId resourceGroup, ResourceGroupManager resourceGroupManager) {
WarningCollector warningCollector = warningCollectorFactory.create();
QueryStateMachine stateMachine = QueryStateMachine.begin(query, preparedQuery.getPrepareSql(), session, locationFactory.createQueryLocation(session.getQueryId()), resourceGroup, resourceGroupManager, isTransactionControlStatement(preparedQuery.getStatement()), transactionManager, accessControl, executor, metadata, warningCollector);
queryMonitor.queryCreatedEvent(stateMachine.getBasicQueryInfo(Optional.empty()));
ListenableFuture<QueryExecution> queryExecutionFuture = executor.submit(() -> {
stateMachine.beginSyntaxAnalysis();
QueryExecutionFactory<?> queryExecutionFactory = executionFactories.get(preparedQuery.getStatement().getClass());
if (queryExecutionFactory == null) {
throw new PrestoException(NOT_SUPPORTED, "Unsupported statement type: " + preparedQuery.getStatement().getClass().getSimpleName());
}
QueryExecution queryExecution = queryExecutionFactory.createQueryExecution(preparedQuery, stateMachine, slug, warningCollector);
stateMachine.endSyntaxAnalysis();
return queryExecution;
});
return new LocalDispatchQuery(stateMachine, queryExecutionFuture, clusterSizeMonitor, executor, queryManager::createQuery);
}
Aggregations