1 | #pragma once |
---|---|
2 | |
3 | #include <DataStreams/IBlockInputStream.h> |
4 | #include <Interpreters/Aggregator.h> |
5 | #include <Core/ColumnNumbers.h> |
6 | |
7 | |
8 | namespace DB |
9 | { |
10 | |
11 | class ExpressionActions; |
12 | |
13 | |
14 | /** Takes blocks after grouping, with non-finalized aggregate functions. |
15 | * Calculates all subsets of columns and aggreagetes over them. |
16 | */ |
17 | class CubeBlockInputStream : public IBlockInputStream |
18 | { |
19 | private: |
20 | using ExpressionActionsPtr = std::shared_ptr<ExpressionActions>; |
21 | using AggregateColumns = std::vector<ColumnRawPtrs>; |
22 | public: |
23 | CubeBlockInputStream( |
24 | const BlockInputStreamPtr & input_, const Aggregator::Params & params_); |
25 | |
26 | String getName() const override { return "Cube"; } |
27 | |
28 | Block getHeader() const override; |
29 | |
30 | protected: |
31 | Block readImpl() override; |
32 | |
33 | private: |
34 | Aggregator aggregator; |
35 | ColumnNumbers keys; |
36 | UInt32 mask = 0; |
37 | Block source_block; |
38 | Block zero_block; |
39 | bool is_data_read = false; |
40 | }; |
41 | |
42 | } |
43 |