1#include "duckdb/execution/operator/helper/physical_execute.hpp"
2#include "duckdb/execution/physical_plan_generator.hpp"
3#include "duckdb/planner/operator/logical_execute.hpp"
4
5namespace duckdb {
6
7unique_ptr<PhysicalOperator> PhysicalPlanGenerator::CreatePlan(LogicalExecute &op) {
8 if (!op.prepared->plan) {
9 D_ASSERT(op.children.size() == 1);
10 auto owned_plan = CreatePlan(op&: *op.children[0]);
11 auto execute = make_uniq<PhysicalExecute>(args&: *owned_plan);
12 execute->owned_plan = std::move(owned_plan);
13 execute->prepared = std::move(op.prepared);
14 return std::move(execute);
15 } else {
16 D_ASSERT(op.children.size() == 0);
17 return make_uniq<PhysicalExecute>(args&: *op.prepared->plan);
18 }
19}
20
21} // namespace duckdb
22