@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;
    }
Esempio n. 2
0
 @Override
 public Void visitOutput(OutputNode node, Void context) {
   String columns = getColumns(node);
   printNode(node, format("Output[%s]", columns), NODE_COLORS.get(NodeType.OUTPUT));
   return node.getSource().accept(this, context);
 }
 @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());
 }