1 | //===----------------------------------------------------------------------===// |
---|---|
2 | // DuckDB |
3 | // |
4 | // duckdb/planner/expression_binder/group_binder.hpp |
5 | // |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | #pragma once |
10 | |
11 | #include "duckdb/common/case_insensitive_map.hpp" |
12 | #include "duckdb/planner/expression_binder.hpp" |
13 | |
14 | namespace duckdb { |
15 | class ConstantExpression; |
16 | class ColumnRefExpression; |
17 | |
18 | //! The GROUP binder is responsible for binding expressions in the GROUP BY clause |
19 | class GroupBinder : public ExpressionBinder { |
20 | public: |
21 | GroupBinder(Binder &binder, ClientContext &context, SelectNode &node, idx_t group_index, |
22 | case_insensitive_map_t<idx_t> &alias_map, case_insensitive_map_t<idx_t> &group_alias_map); |
23 | |
24 | //! The unbound root expression |
25 | unique_ptr<ParsedExpression> unbound_expression; |
26 | //! The group index currently being bound |
27 | idx_t bind_index; |
28 | |
29 | protected: |
30 | BindResult BindExpression(unique_ptr<ParsedExpression> &expr_ptr, idx_t depth, bool root_expression) override; |
31 | |
32 | string UnsupportedAggregateMessage() override; |
33 | |
34 | BindResult BindSelectRef(idx_t entry); |
35 | BindResult BindColumnRef(ColumnRefExpression &expr); |
36 | BindResult BindConstant(ConstantExpression &expr); |
37 | |
38 | SelectNode &node; |
39 | case_insensitive_map_t<idx_t> &alias_map; |
40 | case_insensitive_map_t<idx_t> &group_alias_map; |
41 | unordered_set<idx_t> used_aliases; |
42 | |
43 | idx_t group_index; |
44 | }; |
45 | |
46 | } // namespace duckdb |
47 |