@Override public SubPlanBuilder visitOutput(OutputNode node, Void context) { SubPlanBuilder current = node.getSource().accept(this, context); if (current.isDistributed()) { current.setRoot( new SinkNode( idAllocator.getNextId(), current.getRoot(), current.getRoot().getOutputSymbols())); // create a new non-partitioned fragment current = createSingleNodePlan( new ExchangeNode( idAllocator.getNextId(), current.getId(), current.getRoot().getOutputSymbols())) .addChild(current.build()); } current.setRoot( new OutputNode( node.getId(), current.getRoot(), node.getColumnNames(), node.getOutputSymbols())); return current; }
@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()); }