@Override public Void visitTableFinish(TableFinishNode node, Void context) { printNode(node, format("TableFinish[%s]", Joiner.on(", ").join(node.getOutputSymbols())), NODE_COLORS.get(NodeType.TABLE_FINISH)); return node.getSource().accept(this, context); }
@Override public Result apply(TableFinishNode node, Captures captures, Context context) { return Result.ofPlanNode( new ValuesNode( node.getId(), node.getOutputSymbols(), ImmutableList.of(ImmutableList.of(new LongLiteral("0"))))); } }
@Override public Void visitTableFinish(TableFinishNode node, Integer indent) { print(indent, "- TableCommit[%s] => [%s]", node.getTarget(), formatOutputs(node.getOutputSymbols())); printPlanNodesStatsAndCost(indent + 2, node); printStats(indent + 2, node.getId()); if (node.getStatisticsAggregation().isPresent()) { verify(node.getStatisticsAggregationDescriptor().isPresent(), "statisticsAggregationDescriptor is not present"); printStatisticAggregations(node.getStatisticsAggregation().get(), node.getStatisticsAggregationDescriptor().get(), indent + 2); } return processChildren(node, indent + 1); }
@Override public PlanNode visitTableFinish(TableFinishNode 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()); }
private RelationPlan createDeletePlan(Analysis analysis, Delete node) { DeleteNode deleteNode = new QueryPlanner(analysis, symbolAllocator, idAllocator, buildLambdaDeclarationToSymbolMap(analysis, symbolAllocator), metadata, session) .plan(node); TableFinishNode commitNode = new TableFinishNode( idAllocator.getNextId(), deleteNode, deleteNode.getTarget(), symbolAllocator.newSymbol("rows", BIGINT), Optional.empty(), Optional.empty()); return new RelationPlan(commitNode, analysis.getScope(node), commitNode.getOutputSymbols()); }
descriptor, session); Map<Symbol, Integer> layout = ImmutableMap.of(node.getOutputSymbols().get(0), 0);
Optional.of(result.getDescriptor())); return new RelationPlan(commitNode, analysis.getRootScope(), commitNode.getOutputSymbols()); Optional.empty(), Optional.empty()); return new RelationPlan(commitNode, analysis.getRootScope(), commitNode.getOutputSymbols());
@Override public Void visitTableFinish(TableFinishNode 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); }
@Override public Void visitTableFinish(TableFinishNode node, Void context) { node.getSource().accept(this, context); builder.addAll(node.getOutputSymbols()); return null; }
@Override public PlanNode visitTableFinish(TableFinishNode node, List<PlanNode> newChildren) { return new TableFinishNode(node.getId(), Iterables.getOnlyElement(newChildren), node.getTarget(), node.getOutputSymbols()); }
@Override public Void visitTableFinish(TableFinishNode node, Integer indent) { print(indent, "- TableCommit[%s] => [%s]", node.getTarget(), formatOutputs(node.getOutputSymbols())); return processChildren(node, indent + 1); }
@Override public PhysicalOperation visitTableFinish(TableFinishNode node, LocalExecutionPlanContext context) { PhysicalOperation source = node.getSource().accept(this, context); OperatorFactory operatorFactory = new TableFinishOperatorFactory(context.getNextOperatorId(), node.getId(), createTableFinisher(session, node, metadata)); Map<Symbol, Integer> layout = ImmutableMap.of(node.getOutputSymbols().get(0), 0); return new PhysicalOperation(operatorFactory, layout, source); }
private RelationPlan createDeletePlan(Analysis analysis, Delete node) { QueryPlanner planner = new QueryPlanner(analysis, symbolAllocator, idAllocator, metadata, session, Optional.empty()); DeleteNode deleteNode = planner.planDelete(node); List<Symbol> outputs = ImmutableList.of(symbolAllocator.newSymbol("rows", BIGINT)); TableFinishNode commitNode = new TableFinishNode(idAllocator.getNextId(), deleteNode, deleteNode.getTarget(), outputs); return new RelationPlan(commitNode, analysis.getOutputDescriptor(), commitNode.getOutputSymbols(), Optional.empty()); }
@Override public PlanNode visitTableFinish(TableFinishNode 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()); }
@Override public PlanNode visitTableFinish(TableFinishNode node, RewriteContext<Set<Symbol>> context) { // Maintain the existing inputs needed for TableCommitNode PlanNode source = context.rewrite(node.getSource(), ImmutableSet.copyOf(node.getSource().getOutputSymbols())); return new TableFinishNode(node.getId(), source, node.getTarget(), node.getOutputSymbols()); }
@Override public PlanNode visitTableFinish(TableFinishNode node, RewriteContext<Context> context) { PlanNode child = node.getSource(); TableWriterNode.WriterTarget originalTarget = getTarget(child); TableWriterNode.WriterTarget newTarget = createWriterTarget(originalTarget); context.get().addMaterializedHandle(originalTarget, newTarget); child = child.accept(this, context); return new TableFinishNode(node.getId(), child, newTarget, node.getOutputSymbols()); }