コード例 #1
0
    @Override
    public SubPlanBuilder visitTableCommit(TableCommitNode node, Void context) {
      SubPlanBuilder current = node.getSource().accept(this, context);
      checkState(
          current.getRoot() instanceof TableWriterNode,
          "table commit node must be preceeded by table writer node");
      OutputTableHandle target = ((TableWriterNode) current.getRoot()).getTarget();
      checkNotNull(
          target,
          "target table handle should have been constructed when we visited the table writer node");

      if (current.getDistribution() != PlanDistribution.COORDINATOR_ONLY && !createSingleNodePlan) {
        current.setRoot(
            new SinkNode(
                idAllocator.getNextId(), current.getRoot(), current.getRoot().getOutputSymbols()));

        // create a new non-partitioned fragment to run on the coordinator
        current =
            createCoordinatorOnlyPlan(
                    new ExchangeNode(
                        idAllocator.getNextId(),
                        current.getId(),
                        current.getRoot().getOutputSymbols()))
                .addChild(current.build());
      }

      current.setRoot(
          new TableCommitNode(node.getId(), current.getRoot(), target, node.getOutputSymbols()));

      return current;
    }
コード例 #2
0
 @Override
 public Void visitTableCommit(TableCommitNode node, Void context) {
   printNode(
       node,
       format("TableCommit[%s]", Joiner.on(", ").join(node.getOutputSymbols())),
       NODE_COLORS.get(NodeType.TABLE_COMMIT));
   return node.getSource().accept(this, context);
 }
コード例 #3
0
 @Override
 public PlanNode visitTableCommit(TableCommitNode node, RewriteContext<Void> context) {
   Optional<DeleteNode> delete = findNode(node.getSource(), DeleteNode.class);
   if (!delete.isPresent()) {
     return context.defaultRewrite(node);
   }
   Optional<TableScanNode> tableScan = findNode(delete.get().getSource(), TableScanNode.class);
   if (!tableScan.isPresent()) {
     return context.defaultRewrite(node);
   }
   TableScanNode tableScanNode = tableScan.get();
   if (!metadata.supportsMetadataDelete(
       session, tableScanNode.getTable(), tableScanNode.getLayout().get())) {
     return context.defaultRewrite(node);
   }
   return new MetadataDeleteNode(
       idAllocator.getNextId(),
       delete.get().getTarget(),
       Iterables.getOnlyElement(node.getOutputSymbols()),
       tableScanNode.getLayout().get());
 }