| 1 | #include "duckdb/execution/physical_plan_generator.hpp" |
|---|---|
| 2 | #include "duckdb/execution/operator/persistent/physical_export.hpp" |
| 3 | #include "duckdb/planner/operator/logical_export.hpp" |
| 4 | #include "duckdb/main/config.hpp" |
| 5 | |
| 6 | namespace duckdb { |
| 7 | |
| 8 | unique_ptr<PhysicalOperator> PhysicalPlanGenerator::CreatePlan(LogicalExport &op) { |
| 9 | auto &config = DBConfig::GetConfig(context); |
| 10 | if (!config.options.enable_external_access) { |
| 11 | throw PermissionException("Export is disabled through configuration"); |
| 12 | } |
| 13 | auto export_node = make_uniq<PhysicalExport>(args&: op.types, args&: op.function, args: std::move(op.copy_info), |
| 14 | args&: op.estimated_cardinality, args&: op.exported_tables); |
| 15 | // plan the underlying copy statements, if any |
| 16 | if (!op.children.empty()) { |
| 17 | auto plan = CreatePlan(op&: *op.children[0]); |
| 18 | export_node->children.push_back(x: std::move(plan)); |
| 19 | } |
| 20 | return std::move(export_node); |
| 21 | } |
| 22 | |
| 23 | } // namespace duckdb |
| 24 |