Static import Iterables#getOnlyElement in SqlQueryScheduler
@@ -47,7 +47,6 @@ import com.facebook.presto.sql.planner.plan.RemoteSourceNode;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
import com.google.common.primitives.Ints;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture;
@@ -102,6 +101,7 @@ import static com.google.common.base.Verify.verify;
import static com.google.common.collect.ImmutableList.toImmutableList;
import static com.google.common.collect.ImmutableMap.toImmutableMap;
import static com.google.common.collect.ImmutableSet.toImmutableSet;
+import static com.google.common.collect.Iterables.getOnlyElement;
import static com.google.common.collect.Sets.newConcurrentHashSet;
import static com.google.common.collect.Streams.stream;
import static com.google.common.graph.Traverser.forTree;
@@ -204,7 +204,7 @@ public class SqlQueryScheduler
ImmutableMap.Builder<StageId, StageScheduler> stageSchedulers = ImmutableMap.builder();
ImmutableMap.Builder<StageId, StageLinkage> stageLinkages = ImmutableMap.builder();
- OutputBufferId rootBufferId = Iterables.getOnlyElement(rootOutputBuffers.getBuffers().keySet());
+ OutputBufferId rootBufferId = getOnlyElement(rootOutputBuffers.getBuffers().keySet());
sectionedPlan = extractStreamingSections(plan);
List<SqlStageExecution> stages = createStages(
(fragmentId, tasks, noMoreExchangeLocations) -> updateQueryOutputLocations(queryStateMachine, rootBufferId, tasks, noMoreExchangeLocations),
@@ -413,7 +413,7 @@ public class SqlQueryScheduler
// TODO: defer opening split sources when stage scheduling starts
Map<PlanNodeId, SplitSource> splitSources = splitSourceFactory.createSplitSources(plan.getFragment(), session);
// nodes are selected dynamically based on the constraints of the splits and the system load
- Entry<PlanNodeId, SplitSource> entry = Iterables.getOnlyElement(splitSources.entrySet());
+ Entry<PlanNodeId, SplitSource> entry = getOnlyElement(splitSources.entrySet());
PlanNodeId planNodeId = entry.getKey();
SplitSource splitSource = entry.getValue();
ConnectorId connectorId = splitSource.getConnectorId();
