use of com.facebook.presto.TaskSource in project presto by prestodb.
the class SqlTaskExecution method schedulePartitionedSource.
private synchronized void schedulePartitionedSource(TaskSource source) {
// when the source is scheduled
if (!isSchedulingSource(source.getPlanNodeId())) {
pendingSplits.merge(source.getPlanNodeId(), source, TaskSource::update);
return;
}
DriverSplitRunnerFactory partitionedDriverFactory = partitionedDriverFactories.get(source.getPlanNodeId());
ImmutableList.Builder<DriverSplitRunner> runners = ImmutableList.builder();
for (ScheduledSplit scheduledSplit : source.getSplits()) {
// create a new driver for the split
runners.add(partitionedDriverFactory.createDriverRunner(scheduledSplit, true));
}
enqueueDrivers(false, runners.build());
if (source.isNoMoreSplits()) {
partitionedDriverFactory.setNoMoreSplits();
sourceStartOrder.remove(source.getPlanNodeId());
// schedule next source
if (!sourceStartOrder.isEmpty()) {
TaskSource nextSource = pendingSplits.get(sourceStartOrder.peek());
if (nextSource != null) {
schedulePartitionedSource(nextSource);
}
}
}
}
use of com.facebook.presto.TaskSource in project presto by prestodb.
the class SqlTaskExecution method scheduleUnpartitionedSource.
private synchronized void scheduleUnpartitionedSource(TaskSource source, Map<PlanNodeId, TaskSource> updatedUnpartitionedSources) {
// create new source
TaskSource newSource;
TaskSource currentSource = unpartitionedSources.get(source.getPlanNodeId());
if (currentSource == null) {
newSource = source;
} else {
newSource = currentSource.update(source);
}
// only record new source if something changed
if (newSource != currentSource) {
unpartitionedSources.put(source.getPlanNodeId(), newSource);
updatedUnpartitionedSources.put(source.getPlanNodeId(), newSource);
}
}
Aggregations