1#include "duckdb/planner/binder.hpp"
2#include "duckdb/parser/statement/call_statement.hpp"
3#include "duckdb/parser/tableref/table_function_ref.hpp"
4#include "duckdb/planner/tableref/bound_table_function.hpp"
5#include "duckdb/planner/operator/logical_get.hpp"
6
7namespace duckdb {
8
9BoundStatement Binder::Bind(CallStatement &stmt) {
10 BoundStatement result;
11
12 TableFunctionRef ref;
13 ref.function = std::move(stmt.function);
14
15 auto bound_func = Bind(ref);
16 auto &bound_table_func = bound_func->Cast<BoundTableFunction>();
17 ;
18 auto &get = bound_table_func.get->Cast<LogicalGet>();
19 D_ASSERT(get.returned_types.size() > 0);
20 for (idx_t i = 0; i < get.returned_types.size(); i++) {
21 get.column_ids.push_back(x: i);
22 }
23
24 result.types = get.returned_types;
25 result.names = get.names;
26 result.plan = CreatePlan(ref&: *bound_func);
27 properties.return_type = StatementReturnType::QUERY_RESULT;
28 return result;
29}
30
31} // namespace duckdb
32