1#include "duckdb/planner/binder.hpp"
2#include "duckdb/parser/statement/extension_statement.hpp"
3#include "duckdb/planner/operator/logical_get.hpp"
4
5namespace duckdb {
6
7BoundStatement Binder::Bind(ExtensionStatement &stmt) {
8 BoundStatement result;
9
10 // perform the planning of the function
11 D_ASSERT(stmt.extension.plan_function);
12 auto parse_result =
13 stmt.extension.plan_function(stmt.extension.parser_info.get(), context, std::move(stmt.parse_data));
14
15 properties.modified_databases = parse_result.modified_databases;
16 properties.requires_valid_transaction = parse_result.requires_valid_transaction;
17 properties.return_type = parse_result.return_type;
18
19 // create the plan as a scan of the given table function
20 result.plan = BindTableFunction(function&: parse_result.function, parameters: std::move(parse_result.parameters));
21 D_ASSERT(result.plan->type == LogicalOperatorType::LOGICAL_GET);
22 auto &get = result.plan->Cast<LogicalGet>();
23 result.names = get.names;
24 result.types = get.returned_types;
25 get.column_ids.clear();
26 for (idx_t i = 0; i < get.returned_types.size(); i++) {
27 get.column_ids.push_back(x: i);
28 }
29 return result;
30}
31
32} // namespace duckdb
33