throws InterruptedException
{
AtomicInteger nextTaskId = new AtomicInteger(0);
long getSplitStart = System.nanoTime();
SplitSource splitSource = this.dataSource.get();
while (!splitSource.isFinished()) {
getSplitDistribution.add(System.nanoTime() - getSplitStart);
// if query has been canceled, exit cleanly; query will never run regardless
if (getState().isDone()) {
break;
}
Set<Split> pendingSplits = ImmutableSet.copyOf(splitSource.getNextBatch(splitBatchSize));
while (!pendingSplits.isEmpty() && !getState().isDone()) {
Multimap<Node, Split> splitAssignment = nodeSelector.computeAssignments(pendingSplits);
pendingSplits = ImmutableSet.copyOf(Sets.difference(pendingSplits, ImmutableSet.copyOf(splitAssignment.values())));
assignSplits(nextTaskId, splitAssignment);