List<TaskSource> sources = new ArrayList<>();
long sequenceId = 0;
for (PlanNode sourceNode : subplan.getFragment().getSources()) {
TableScanNode tableScan = (TableScanNode) sourceNode;
DataSource dataSource = splitManager.getSplits(session,
tableScan.getTable(),
tableScan.getPartitionPredicate(),
tableScan.getUpstreamPredicateHint(),
Predicates.<Partition>alwaysTrue(),
tableScan.getAssignments());
ImmutableSet.Builder<ScheduledSplit> scheduledSplits = ImmutableSet.builder();
for (Split split : dataSource.getSplits()) {
scheduledSplits.add(new ScheduledSplit(sequenceId++, split));
}
sources.add(new TaskSource(tableScan.getId(), scheduledSplits.build(), true));
}