use of io.prestosql.sql.planner.plan.TableWriterNode.DeleteTarget in project hetu-core by openlookeng.
the class QueryPlanner method plan.
public DeleteNode plan(Delete node) {
Table table = node.getTable();
TableHandle handle = analysis.getTableHandle(table);
RelationPlan relationPlan = new RelationPlanner(analysis, planSymbolAllocator, idAllocator, lambdaDeclarationToSymbolMap, metadata, session, namedSubPlan, uniqueIdAllocator).process(table, null);
PlanBuilder builder = planBuilderFor(relationPlan);
if (node.getWhere().isPresent()) {
builder = filter(builder, node.getWhere().get(), node);
}
// create delete node
Symbol rowId = builder.translate(analysis.getRowIdField(table));
List<Symbol> outputs = ImmutableList.of(planSymbolAllocator.newSymbol("partialrows", BIGINT), planSymbolAllocator.newSymbol("fragment", VARBINARY));
return new DeleteNode(idAllocator.getNextId(), builder.getRoot(), new DeleteTarget(handle, metadata.getTableMetadata(session, handle).getTable()), rowId, outputs);
}
Aggregations