@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;
    }
Example #2
0
    @Override
    public PlanNode visitOutput(OutputNode node, RewriteContext<FragmentProperties> context) {
      context
          .get()
          .setSingleNodeDistribution() // TODO: add support for distributed output
          .setOutputLayout(node.getOutputSymbols())
          .setUnpartitionedOutput();

      return context.defaultRewrite(node, context.get());
    }
Example #3
0
 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;
 }
Example #4
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());
 }