1 | #include "duckdb/execution/operator/schema/physical_create_table.hpp" |
2 | |
3 | #include "duckdb/catalog/catalog.hpp" |
4 | #include "duckdb/catalog/catalog_entry/table_catalog_entry.hpp" |
5 | #include "duckdb/execution/expression_executor.hpp" |
6 | #include "duckdb/storage/data_table.hpp" |
7 | |
8 | namespace duckdb { |
9 | |
10 | PhysicalCreateTable::PhysicalCreateTable(LogicalOperator &op, SchemaCatalogEntry &schema, |
11 | unique_ptr<BoundCreateTableInfo> info, idx_t estimated_cardinality) |
12 | : PhysicalOperator(PhysicalOperatorType::CREATE_TABLE, op.types, estimated_cardinality), schema(schema), |
13 | info(std::move(info)) { |
14 | } |
15 | |
16 | //===--------------------------------------------------------------------===// |
17 | // Source |
18 | //===--------------------------------------------------------------------===// |
19 | SourceResultType PhysicalCreateTable::GetData(ExecutionContext &context, DataChunk &chunk, |
20 | OperatorSourceInput &input) const { |
21 | auto &catalog = schema.catalog; |
22 | catalog.CreateTable(transaction: catalog.GetCatalogTransaction(context&: context.client), schema, info&: *info); |
23 | |
24 | return SourceResultType::FINISHED; |
25 | } |
26 | |
27 | } // namespace duckdb |
28 | |