PlanNode source = rewriteDeleteTableScan(((FilterNode) node).getSource(), handle); return replaceChildren(node, ImmutableList.of(source)); PlanNode source = rewriteDeleteTableScan(((ProjectNode) node).getSource(), handle); return replaceChildren(node, ImmutableList.of(source)); PlanNode source = rewriteDeleteTableScan(((SemiJoinNode) node).getSource(), handle); return replaceChildren(node, ImmutableList.of(source, ((SemiJoinNode) node).getFilteringSource())); JoinNode joinNode = (JoinNode) node; if (joinNode.getType() == JoinNode.Type.INNER && isAtMostScalar(joinNode.getRight())) { PlanNode source = rewriteDeleteTableScan(joinNode.getLeft(), handle); return replaceChildren(node, ImmutableList.of(source, joinNode.getRight()));
PlanNode source = rewriteDeleteTableScan(((FilterNode) node).getSource(), handle, context); return replaceChildren(node, ImmutableList.of(source)); PlanNode source = rewriteDeleteTableScan(((ProjectNode) node).getSource(), handle, context); return replaceChildren(node, ImmutableList.of(source)); PlanNode source = rewriteDeleteTableScan(((SemiJoinNode) node).getSource(), handle, context); return replaceChildren(node, ImmutableList.of(source, ((SemiJoinNode) node).getFilteringSource()));
@Override public PlanNode optimize(PlanNode plan, Session session, Map<Symbol, Type> types, SymbolAllocator symbolAllocator, PlanNodeIdAllocator idAllocator) { return SimplePlanRewriter.rewriteWith(new Rewriter(session), plan, new Context()); }
@Override public PlanNode visitDelete(DeleteNode node, RewriteContext<Context> context) { TableWriterNode.DeleteHandle deleteHandle = (TableWriterNode.DeleteHandle) context.get().getMaterializedHandle(node.getTarget()).get(); return new DeleteNode( node.getId(), rewriteDeleteTableScan(node.getSource(), deleteHandle.getHandle(), context), deleteHandle, node.getRowId(), 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()); }
@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.getRowCountSymbol(), node.getStatisticsAggregation(), node.getStatisticsAggregationDescriptor()); }
@Override public PlanNode optimize(PlanNode plan, Session session, TypeProvider types, SymbolAllocator symbolAllocator, PlanNodeIdAllocator idAllocator, WarningCollector warningCollector) { return SimplePlanRewriter.rewriteWith(new Rewriter(session), plan, new Context()); }
@Override public PlanNode visitDelete(DeleteNode node, RewriteContext<Context> context) { TableWriterNode.DeleteHandle deleteHandle = (TableWriterNode.DeleteHandle) context.get().getMaterializedHandle(node.getTarget()).get(); return new DeleteNode( node.getId(), rewriteDeleteTableScan(node.getSource(), deleteHandle.getHandle()), deleteHandle, node.getRowId(), node.getOutputSymbols()); }