1#include "duckdb/planner/binder.hpp"
2#include "duckdb/planner/tableref/bound_expressionlistref.hpp"
3#include "duckdb/planner/operator/logical_expression_get.hpp"
4#include "duckdb/planner/operator/logical_dummy_scan.hpp"
5
6namespace duckdb {
7
8unique_ptr<LogicalOperator> Binder::CreatePlan(BoundExpressionListRef &ref) {
9 auto root = make_uniq_base<LogicalOperator, LogicalDummyScan>(args: GenerateTableIndex());
10 // values list, first plan any subqueries in the list
11 for (auto &expr_list : ref.values) {
12 for (auto &expr : expr_list) {
13 PlanSubqueries(expr, root);
14 }
15 }
16 // now create a LogicalExpressionGet from the set of expressions
17 // fetch the types
18 vector<LogicalType> types;
19 for (auto &expr : ref.values[0]) {
20 types.push_back(x: expr->return_type);
21 }
22 auto expr_get = make_uniq<LogicalExpressionGet>(args&: ref.bind_index, args&: types, args: std::move(ref.values));
23 expr_get->AddChild(child: std::move(root));
24 return std::move(expr_get);
25}
26
27} // namespace duckdb
28