#pragma once #include #include #include namespace DB { class ExpressionActions; /** Takes blocks after grouping, with non-finalized aggregate functions. * Calculates all subsets of columns and aggreagetes over them. */ class CubeBlockInputStream : public IBlockInputStream { private: using ExpressionActionsPtr = std::shared_ptr; using AggregateColumns = std::vector; public: CubeBlockInputStream( const BlockInputStreamPtr & input_, const Aggregator::Params & params_); String getName() const override { return "Cube"; } Block getHeader() const override; protected: Block readImpl() override; private: Aggregator aggregator; ColumnNumbers keys; UInt32 mask = 0; Block source_block; Block zero_block; bool is_data_read = false; }; }