public StageExecutionPlan( PlanFragment fragment, Map<PlanNodeId, SplitSource> splitSources, List<StageExecutionPlan> subStages) { this.fragment = requireNonNull(fragment, "fragment is null"); this.splitSources = requireNonNull(splitSources, "dataSource is null"); this.subStages = ImmutableList.copyOf(requireNonNull(subStages, "dependencies is null")); fieldNames = (fragment.getRoot() instanceof OutputNode) ? Optional.of(ImmutableList.copyOf(((OutputNode) fragment.getRoot()).getColumnNames())) : Optional.empty(); }
public StageExecutionPlan( PlanFragment fragment, Map<PlanNodeId, SplitSource> splitSources, List<StageExecutionPlan> subStages) { this.fragment = requireNonNull(fragment, "fragment is null"); this.splitSources = requireNonNull(splitSources, "dataSource is null"); this.subStages = ImmutableList.copyOf(requireNonNull(subStages, "dependencies is null")); fieldNames = (fragment.getRoot() instanceof OutputNode) ? Optional.of(ImmutableList.copyOf(((OutputNode) fragment.getRoot()).getColumnNames())) : Optional.empty(); }
public void processFragment(PlanFragmentId planFragmentId) { PlanFragment planFragment = fragments.get(planFragmentId); checkArgument(planFragment != null, "Fragment not found: %s", planFragmentId); planFragment.getRoot().accept(this, null); schedulerOrder.add(planFragmentId); }
public void processFragment(PlanFragmentId planFragmentId) { PlanFragment planFragment = fragments.get(planFragmentId); checkArgument(planFragment != null, "Fragment not found: %s", planFragmentId); planFragment.getRoot().accept(this, null); schedulerOrder.add(planFragmentId); }
private Set<PlanFragmentId> processFragment(PlanFragment fragment) { Set<PlanFragmentId> sources = fragment.getRoot().accept(this, fragment.getId()); return ImmutableSet.<PlanFragmentId>builder().add(fragment.getId()).addAll(sources).build(); }
@Override public Void visitRemoteSource(RemoteSourceNode node, Void context) { for (PlanFragmentId planFragmentId : node.getSourceFragmentIds()) { PlanFragment target = fragmentsById.get(planFragmentId); printEdge(node, target.getRoot()); } return null; }
private Set<PlanFragmentId> processFragment(PlanFragment fragment) { Set<PlanFragmentId> sources = fragment.getRoot().accept(this, fragment.getId()); return ImmutableSet.<PlanFragmentId>builder().add(fragment.getId()).addAll(sources).build(); }
private static void printFragmentNodes(StringBuilder output, PlanFragment fragment, PlanNodeIdGenerator idGenerator) { String clusterId = "cluster_" + fragment.getId(); output.append("subgraph ") .append(clusterId) .append(" {") .append('\n'); output.append(format("label = \"%s\"", fragment.getPartitioning())) .append('\n'); PlanNode plan = fragment.getRoot(); plan.accept(new NodePrinter(output, idGenerator), null); output.append("}") .append('\n'); }
@Override public Void visitRemoteSource(RemoteSourceNode node, Void context) { for (PlanFragmentId planFragmentId : node.getSourceFragmentIds()) { PlanFragment target = fragmentsById.get(planFragmentId); printEdge(node, target.getRoot()); } return null; }
private static void printFragmentNodes(StringBuilder output, PlanFragment fragment, PlanNodeIdGenerator idGenerator) { String clusterId = "cluster_" + fragment.getId(); output.append("subgraph ") .append(clusterId) .append(" {") .append('\n'); output.append(format("label = \"%s\"", fragment.getPartitioning())) .append('\n'); PlanNode plan = fragment.getRoot(); plan.accept(new NodePrinter(output, idGenerator), null); output.append("}") .append('\n'); }
public static String printLogical(List<PlanFragment> fragments) { Map<PlanFragmentId, PlanFragment> fragmentsById = Maps.uniqueIndex(fragments, PlanFragment::getId); PlanNodeIdGenerator idGenerator = new PlanNodeIdGenerator(); StringBuilder output = new StringBuilder(); output.append("digraph logical_plan {\n"); for (PlanFragment fragment : fragments) { printFragmentNodes(output, fragment, idGenerator); } for (PlanFragment fragment : fragments) { fragment.getRoot().accept(new EdgePrinter(output, fragmentsById, idGenerator), null); } output.append("}\n"); return output.toString(); }
public static String printLogical(List<PlanFragment> fragments) { Map<PlanFragmentId, PlanFragment> fragmentsById = Maps.uniqueIndex(fragments, PlanFragment::getId); PlanNodeIdGenerator idGenerator = new PlanNodeIdGenerator(); StringBuilder output = new StringBuilder(); output.append("digraph logical_plan {\n"); for (PlanFragment fragment : fragments) { printFragmentNodes(output, fragment, idGenerator); } for (PlanFragment fragment : fragments) { fragment.getRoot().accept(new EdgePrinter(output, fragmentsById, idGenerator), null); } output.append("}\n"); return output.toString(); }
private StageExecutionPlan doPlan(SubPlan root, Session session, ImmutableList.Builder<SplitSource> allSplitSources) { PlanFragment currentFragment = root.getFragment(); // get splits for this fragment, this is lazy so split assignments aren't actually calculated here Map<PlanNodeId, SplitSource> splitSources = currentFragment.getRoot().accept(new Visitor(session, currentFragment.getStageExecutionStrategy(), allSplitSources), null); // create child stages ImmutableList.Builder<StageExecutionPlan> dependencies = ImmutableList.builder(); for (SubPlan childPlan : root.getChildren()) { dependencies.add(doPlan(childPlan, session, allSplitSources)); } return new StageExecutionPlan( currentFragment, splitSources, dependencies.build()); }
private StageExecutionPlan doPlan(SubPlan root, Session session, ImmutableList.Builder<SplitSource> allSplitSources) { PlanFragment currentFragment = root.getFragment(); // get splits for this fragment, this is lazy so split assignments aren't actually calculated here Map<PlanNodeId, SplitSource> splitSources = currentFragment.getRoot().accept(new Visitor(session, currentFragment.getStageExecutionDescriptor(), allSplitSources), null); // create child stages ImmutableList.Builder<StageExecutionPlan> dependencies = ImmutableList.builder(); for (SubPlan childPlan : root.getChildren()) { dependencies.add(doPlan(childPlan, session, allSplitSources)); } return new StageExecutionPlan( currentFragment, splitSources, dependencies.build()); }
private SubPlan analyzeGroupedExecution(Session session, SubPlan subPlan) { PlanFragment fragment = subPlan.getFragment(); GroupedExecutionProperties properties = fragment.getRoot().accept(new GroupedExecutionTagger(session, metadata, nodePartitioningManager), null); if (properties.isSubTreeUseful()) { fragment = fragment.withGroupedExecution(properties.getCapableTableScanNodes()); } ImmutableList.Builder<SubPlan> result = ImmutableList.builder(); for (SubPlan child : subPlan.getChildren()) { result.add(analyzeGroupedExecution(session, child)); } return new SubPlan(fragment, result.build()); }
private SubPlan analyzeGroupedExecution(Session session, SubPlan subPlan) { PlanFragment fragment = subPlan.getFragment(); GroupedExecutionProperties properties = fragment.getRoot().accept(new GroupedExecutionTagger(session, metadata, nodePartitioningManager), null); if (properties.isSubTreeUseful()) { fragment = fragment.withGroupedExecution(properties.getCapableTableScanNodes()); } ImmutableList.Builder<SubPlan> result = ImmutableList.builder(); for (SubPlan child : subPlan.getChildren()) { result.add(analyzeGroupedExecution(session, child)); } return new SubPlan(fragment, result.build()); }
private static void printSubPlan(SubPlan plan, Map<PlanFragmentId, PlanFragment> fragmentsById, PlanNodeIdGenerator idGenerator, StringBuilder output) { PlanFragment fragment = plan.getFragment(); printFragmentNodes(output, fragment, idGenerator); fragment.getRoot().accept(new EdgePrinter(output, fragmentsById, idGenerator), null); for (SubPlan child : plan.getChildren()) { printSubPlan(child, fragmentsById, idGenerator, output); } }
private static void printSubPlan(SubPlan plan, Map<PlanFragmentId, PlanFragment> fragmentsById, PlanNodeIdGenerator idGenerator, StringBuilder output) { PlanFragment fragment = plan.getFragment(); printFragmentNodes(output, fragment, idGenerator); fragment.getRoot().accept(new EdgePrinter(output, fragmentsById, idGenerator), null); for (SubPlan child : plan.getChildren()) { printSubPlan(child, fragmentsById, idGenerator, output); } }
localExecutionPlan = planner.plan( taskContext, fragment.getRoot(), TypeProvider.copyOf(fragment.getSymbols()), fragment.getPartitioningScheme(),
PlanNode newRoot = fragment.getRoot();