| 1 | #pragma once |
|---|---|
| 2 | #include <Processors/IInflatingTransform.h> |
| 3 | #include <Processors/Transforms/AggregatingTransform.h> |
| 4 | |
| 5 | |
| 6 | namespace DB |
| 7 | { |
| 8 | |
| 9 | /// Takes blocks after grouping, with non-finalized aggregate functions. |
| 10 | /// Calculates all subsets of columns and aggregates over them. |
| 11 | class CubeTransform : public IAccumulatingTransform |
| 12 | { |
| 13 | public: |
| 14 | CubeTransform(Block header, AggregatingTransformParamsPtr params); |
| 15 | String getName() const override { return "CubeTransform"; } |
| 16 | |
| 17 | protected: |
| 18 | void consume(Chunk chunk) override; |
| 19 | Chunk generate() override; |
| 20 | |
| 21 | private: |
| 22 | AggregatingTransformParamsPtr params; |
| 23 | ColumnNumbers keys; |
| 24 | |
| 25 | Chunks consumed_chunks; |
| 26 | Chunk cube_chunk; |
| 27 | Columns current_columns; |
| 28 | Columns current_zero_columns; |
| 29 | |
| 30 | UInt64 mask = 0; |
| 31 | |
| 32 | Chunk merge(Chunks && chunks, bool final); |
| 33 | }; |
| 34 | |
| 35 | } |
| 36 |