private static String getColumns(OutputNode node) { Iterator<String> columnNames = node.getColumnNames().iterator(); String columns = ""; int nameWidth = 0; while (columnNames.hasNext()) { String columnName = columnNames.next(); columns += columnName; nameWidth += columnName.length(); if (columnNames.hasNext()) { columns += ", "; } if (nameWidth >= MAX_NAME_WIDTH) { columns += "\\n"; nameWidth = 0; } } return columns; }
private static StatsContext buildStatsContext(Plan queryPlan, OutputNode outputNode) { ImmutableMap.Builder<String, Symbol> columnSymbols = ImmutableMap.builder(); for (int columnId = 0; columnId < outputNode.getColumnNames().size(); ++columnId) { columnSymbols.put(outputNode.getColumnNames().get(columnId), outputNode.getOutputSymbols().get(columnId)); } return new StatsContext(columnSymbols.build(), queryPlan.getTypes()); }
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(); }
@Override public Void visitOutput(OutputNode node, Integer indent) { print(indent, "- Output[%s] => [%s]", Joiner.on(", ").join(node.getColumnNames()), formatOutputs(node.getOutputSymbols())); printPlanNodesStatsAndCost(indent + 2, node); printStats(indent + 2, node.getId()); for (int i = 0; i < node.getColumnNames().size(); i++) { String name = node.getColumnNames().get(i); Symbol symbol = node.getOutputSymbols().get(i); if (!name.equals(symbol.toString())) { print(indent + 2, "%s := %s", name, symbol); } } return processChildren(node, indent + 1); }
@Override public PlanNode visitOutput(OutputNode node, RewriteContext<Void> context) { PlanNode source = context.rewrite(node.getSource()); List<Symbol> canonical = Lists.transform(node.getOutputSymbols(), this::canonicalize); return new OutputNode(node.getId(), source, node.getColumnNames(), canonical); }
@Override public PlanNode visitOutput(OutputNode node, RewriteContext<Set<Symbol>> context) { Set<Symbol> expectedInputs = ImmutableSet.copyOf(node.getOutputSymbols()); PlanNode source = context.rewrite(node.getSource(), expectedInputs); return new OutputNode(node.getId(), source, node.getColumnNames(), node.getOutputSymbols()); }
private static String getColumns(OutputNode node) { Iterator<String> columnNames = node.getColumnNames().iterator(); String columns = ""; int nameWidth = 0; while (columnNames.hasNext()) { String columnName = columnNames.next(); columns += columnName; nameWidth += columnName.length(); if (columnNames.hasNext()) { columns += ", "; } if (nameWidth >= MAX_NAME_WIDTH) { columns += "\\n"; nameWidth = 0; } } return columns; }
public StageExecutionPlan( PlanFragment fragment, Optional<SplitSource> dataSource, List<StageExecutionPlan> subStages) { this.fragment = requireNonNull(fragment, "fragment is null"); this.dataSource = requireNonNull(dataSource, "dataSource is null"); this.subStages = ImmutableList.copyOf(requireNonNull(subStages, "dependencies is null")); fieldNames = (fragment.getRoot() instanceof OutputNode) ? Optional.<List<String>>of(ImmutableList.copyOf(((OutputNode) fragment.getRoot()).getColumnNames())) : Optional.empty(); }
private static StatsContext buildStatsContext(Plan queryPlan, OutputNode outputNode) { ImmutableMap.Builder<String, Symbol> columnSymbols = ImmutableMap.builder(); for (int columnId = 0; columnId < outputNode.getColumnNames().size(); ++columnId) { columnSymbols.put(outputNode.getColumnNames().get(columnId), outputNode.getOutputSymbols().get(columnId)); } return new StatsContext(columnSymbols.build(), queryPlan.getTypes()); }
@Override public Void visitOutput(OutputNode node, Integer indent) { print(indent, "- Output[%s] => [%s]", Joiner.on(", ").join(node.getColumnNames()), formatOutputs(node.getOutputSymbols())); for (int i = 0; i < node.getColumnNames().size(); i++) { String name = node.getColumnNames().get(i); Symbol symbol = node.getOutputSymbols().get(i); if (!name.equals(symbol.toString())) { print(indent + 2, "%s := %s", name, symbol); } } return processChildren(node, indent + 1); }
@Override public PlanNode visitOutput(OutputNode node, List<PlanNode> newChildren) { return new OutputNode(node.getId(), Iterables.getOnlyElement(newChildren), node.getColumnNames(), node.getOutputSymbols()); }
@Override public PlanNode visitOutput(OutputNode node, RewriteContext<Void> context) { PlanNode source = context.rewrite(node.getSource()); List<Symbol> canonical = Lists.transform(node.getOutputSymbols(), this::canonicalize); return new OutputNode(node.getId(), source, node.getColumnNames(), canonical); }
@Override public PlanNode visitOutput(OutputNode node, RewriteContext<Set<Symbol>> context) { Set<Symbol> expectedInputs = ImmutableSet.copyOf(node.getOutputSymbols()); PlanNode source = context.rewrite(node.getSource(), expectedInputs); return new OutputNode(node.getId(), source, node.getColumnNames(), node.getOutputSymbols()); }