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_get.hpp" |
5 | |
6 | using namespace duckdb; |
7 | using namespace std; |
8 | |
9 | unique_ptr<LogicalOperator> Binder::CreatePlan(BoundExpressionListRef &ref) { |
10 | auto root = make_unique_base<LogicalOperator, LogicalGet>(0); |
11 | // values list, first plan any subqueries in the list |
12 | for (auto &expr_list : ref.values) { |
13 | for (auto &expr : expr_list) { |
14 | PlanSubqueries(&expr, &root); |
15 | } |
16 | } |
17 | // now create a LogicalExpressionGet from the set of expressions |
18 | // fetch the types |
19 | vector<TypeId> types; |
20 | for (auto &expr : ref.values[0]) { |
21 | types.push_back(expr->return_type); |
22 | } |
23 | auto expr_get = make_unique<LogicalExpressionGet>(ref.bind_index, types, move(ref.values)); |
24 | expr_get->AddChild(move(root)); |
25 | return move(expr_get); |
26 | } |
27 |