1 | //===----------------------------------------------------------------------===// |
---|---|
2 | // DuckDB |
3 | // |
4 | // duckdb/planner/expression/bound_aggregate_expression.hpp |
5 | // |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | #pragma once |
10 | |
11 | #include "duckdb/planner/expression.hpp" |
12 | #include "duckdb/function/aggregate_function.hpp" |
13 | #include <memory> |
14 | |
15 | namespace duckdb { |
16 | |
17 | class BoundAggregateExpression : public Expression { |
18 | public: |
19 | static constexpr const ExpressionClass TYPE = ExpressionClass::BOUND_AGGREGATE; |
20 | |
21 | public: |
22 | BoundAggregateExpression(AggregateFunction function, vector<unique_ptr<Expression>> children, |
23 | unique_ptr<Expression> filter, unique_ptr<FunctionData> bind_info, |
24 | AggregateType aggr_type); |
25 | |
26 | //! The bound function expression |
27 | AggregateFunction function; |
28 | //! List of arguments to the function |
29 | vector<unique_ptr<Expression>> children; |
30 | //! The bound function data (if any) |
31 | unique_ptr<FunctionData> bind_info; |
32 | //! The aggregate type (distinct or non-distinct) |
33 | AggregateType aggr_type; |
34 | |
35 | //! Filter for this aggregate |
36 | unique_ptr<Expression> filter; |
37 | //! The order by expression for this aggregate - if any |
38 | unique_ptr<BoundOrderModifier> order_bys; |
39 | |
40 | public: |
41 | bool IsDistinct() const { |
42 | return aggr_type == AggregateType::DISTINCT; |
43 | } |
44 | |
45 | bool IsAggregate() const override { |
46 | return true; |
47 | } |
48 | bool IsFoldable() const override { |
49 | return false; |
50 | } |
51 | bool PropagatesNullValues() const override; |
52 | |
53 | string ToString() const override; |
54 | |
55 | hash_t Hash() const override; |
56 | bool Equals(const BaseExpression &other) const override; |
57 | unique_ptr<Expression> Copy() override; |
58 | void Serialize(FieldWriter &writer) const override; |
59 | static unique_ptr<Expression> Deserialize(ExpressionDeserializationState &state, FieldReader &reader); |
60 | }; |
61 | } // namespace duckdb |
62 |