1 | #pragma once |
---|---|
2 | #include <Processors/IAccumulatingTransform.h> |
3 | #include <Processors/Transforms/AggregatingTransform.h> |
4 | |
5 | namespace DB |
6 | { |
7 | |
8 | /// Takes blocks after grouping, with non-finalized aggregate functions. |
9 | /// Calculates subtotals and grand totals values for a set of columns. |
10 | class RollupTransform : public IAccumulatingTransform |
11 | { |
12 | public: |
13 | RollupTransform(Block header, AggregatingTransformParamsPtr params); |
14 | String getName() const override { return "RollupTransform"; } |
15 | |
16 | protected: |
17 | void consume(Chunk chunk) override; |
18 | Chunk generate() override; |
19 | |
20 | private: |
21 | AggregatingTransformParamsPtr params; |
22 | ColumnNumbers keys; |
23 | Chunks consumed_chunks; |
24 | Chunk rollup_chunk; |
25 | size_t last_removed_key = 0; |
26 | |
27 | Chunk merge(Chunks && chunks, bool final); |
28 | }; |
29 | |
30 | } |
31 |