/src/duckdb/src/execution/physical_plan/plan_update.cpp
Line | Count | Source |
1 | | #include "duckdb/catalog/catalog_entry/table_catalog_entry.hpp" |
2 | | #include "duckdb/execution/operator/persistent/physical_update.hpp" |
3 | | #include "duckdb/execution/physical_plan_generator.hpp" |
4 | | #include "duckdb/planner/operator/logical_update.hpp" |
5 | | #include "duckdb/catalog/duck_catalog.hpp" |
6 | | |
7 | | namespace duckdb { |
8 | | |
9 | | PhysicalOperator &DuckCatalog::PlanUpdate(ClientContext &context, PhysicalPlanGenerator &planner, LogicalUpdate &op, |
10 | 0 | PhysicalOperator &plan) { |
11 | 0 | auto &update = planner.Make<PhysicalUpdate>( |
12 | 0 | op.types, op.table, op.table.GetStorage(), op.columns, std::move(op.expressions), std::move(op.bound_defaults), |
13 | 0 | std::move(op.bound_constraints), op.estimated_cardinality, op.return_chunk); |
14 | 0 | auto &cast_update = update.Cast<PhysicalUpdate>(); |
15 | 0 | cast_update.update_is_del_and_insert = op.update_is_del_and_insert; |
16 | 0 | cast_update.children.push_back(plan); |
17 | 0 | return update; |
18 | 0 | } |
19 | | |
20 | 0 | PhysicalOperator &Catalog::PlanUpdate(ClientContext &context, PhysicalPlanGenerator &planner, LogicalUpdate &op) { |
21 | 0 | auto &plan = planner.CreatePlan(*op.children[0]); |
22 | 0 | return PlanUpdate(context, planner, op, plan); |
23 | 0 | } |
24 | | |
25 | 0 | PhysicalOperator &PhysicalPlanGenerator::CreatePlan(LogicalUpdate &op) { |
26 | 0 | D_ASSERT(op.children.size() == 1); |
27 | 0 | dependencies.AddDependency(op.table); |
28 | 0 | return op.table.catalog.PlanUpdate(context, *this, op); |
29 | 0 | } |
30 | | |
31 | | } // namespace duckdb |