1 | //===----------------------------------------------------------------------===// |
---|---|
2 | // DuckDB |
3 | // |
4 | // duckdb/planner/bound_result_modifier.hpp |
5 | // |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | #pragma once |
10 | |
11 | #include "duckdb/parser/result_modifier.hpp" |
12 | #include "duckdb/planner/expression.hpp" |
13 | |
14 | namespace duckdb { |
15 | |
16 | //! A ResultModifier |
17 | class BoundResultModifier { |
18 | public: |
19 | BoundResultModifier(ResultModifierType type) : type(type) { |
20 | } |
21 | virtual ~BoundResultModifier() { |
22 | } |
23 | |
24 | ResultModifierType type; |
25 | }; |
26 | |
27 | struct BoundOrderByNode { |
28 | BoundOrderByNode() { |
29 | } |
30 | BoundOrderByNode(OrderType type, unique_ptr<Expression> expression) : type(type), expression(move(expression)) { |
31 | } |
32 | |
33 | OrderType type; |
34 | unique_ptr<Expression> expression; |
35 | }; |
36 | |
37 | class BoundLimitModifier : public BoundResultModifier { |
38 | public: |
39 | BoundLimitModifier() : BoundResultModifier(ResultModifierType::LIMIT_MODIFIER) { |
40 | } |
41 | |
42 | //! LIMIT count |
43 | int64_t limit = -1; |
44 | //! OFFSET |
45 | int64_t offset = -1; |
46 | }; |
47 | |
48 | class BoundOrderModifier : public BoundResultModifier { |
49 | public: |
50 | BoundOrderModifier() : BoundResultModifier(ResultModifierType::ORDER_MODIFIER) { |
51 | } |
52 | |
53 | //! List of order nodes |
54 | vector<BoundOrderByNode> orders; |
55 | }; |
56 | |
57 | class BoundDistinctModifier : public BoundResultModifier { |
58 | public: |
59 | BoundDistinctModifier() : BoundResultModifier(ResultModifierType::DISTINCT_MODIFIER) { |
60 | } |
61 | |
62 | //! list of distinct on targets (if any) |
63 | vector<unique_ptr<Expression>> target_distincts; |
64 | }; |
65 | |
66 | } // namespace duckdb |
67 |