Search in sources :

Example 1 with DeleteTarget

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);
}
Also used : DeleteNode(io.prestosql.sql.planner.plan.DeleteNode) Table(io.prestosql.sql.tree.Table) Symbol(io.prestosql.spi.plan.Symbol) TableHandle(io.prestosql.spi.metadata.TableHandle) DeleteTarget(io.prestosql.sql.planner.plan.TableWriterNode.DeleteTarget)

Aggregations

TableHandle (io.prestosql.spi.metadata.TableHandle)1 Symbol (io.prestosql.spi.plan.Symbol)1 DeleteNode (io.prestosql.sql.planner.plan.DeleteNode)1 DeleteTarget (io.prestosql.sql.planner.plan.TableWriterNode.DeleteTarget)1 Table (io.prestosql.sql.tree.Table)1