/src/duckdb/src/execution/base_aggregate_hashtable.cpp
Line | Count | Source |
1 | | #include "duckdb/execution/base_aggregate_hashtable.hpp" |
2 | | #include "duckdb/planner/expression/bound_aggregate_expression.hpp" |
3 | | #include "duckdb/storage/buffer_manager.hpp" |
4 | | |
5 | | namespace duckdb { |
6 | | |
7 | | BaseAggregateHashTable::BaseAggregateHashTable(ClientContext &context, Allocator &allocator, |
8 | | const vector<AggregateObject> &aggregates, |
9 | | vector<LogicalType> payload_types_p) |
10 | 0 | : allocator(allocator), buffer_manager(BufferManager::GetBufferManager(context)), |
11 | 0 | layout_ptr(make_shared_ptr<TupleDataLayout>()), payload_types(std::move(payload_types_p)) { |
12 | 0 | filter_set.Initialize(context, aggregates, payload_types); |
13 | 0 | } |
14 | | |
15 | 0 | bool BaseAggregateHashTable::AllAggregatesClustered(const vector<AggregateObject> &aggregates) { |
16 | 0 | if (aggregates.empty()) { |
17 | 0 | return false; |
18 | 0 | } |
19 | 0 | for (auto &aggregate : aggregates) { |
20 | 0 | if (aggregate.filter || !aggregate.function.GetStateClusterUpdateCallback()) { |
21 | 0 | return false; |
22 | 0 | } |
23 | 0 | } |
24 | 0 | return true; |
25 | 0 | } |
26 | | |
27 | 0 | idx_t BaseAggregateHashTable::CountAggregatesClustered(const vector<AggregateObject> &aggregates) { |
28 | 0 | idx_t count = 0; |
29 | 0 | for (auto &aggregate : aggregates) { |
30 | 0 | if (!aggregate.filter && aggregate.function.GetStateClusterUpdateCallback()) { |
31 | 0 | count++; |
32 | 0 | } |
33 | 0 | } |
34 | 0 | return count; |
35 | 0 | } |
36 | | |
37 | | } // namespace duckdb |