2018-09-17 18:01:04 +00:00
|
|
|
#pragma once
|
|
|
|
|
2019-01-23 14:48:50 +00:00
|
|
|
#include <DataStreams/IBlockInputStream.h>
|
2018-09-17 18:01:04 +00:00
|
|
|
#include <Interpreters/Aggregator.h>
|
|
|
|
#include <Core/ColumnNumbers.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
class ExpressionActions;
|
|
|
|
|
|
|
|
|
|
|
|
/** Takes blocks after grouping, with non-finalized aggregate functions.
|
2018-09-19 11:18:38 +00:00
|
|
|
* Calculates all subsets of columns and aggreagetes over them.
|
2018-09-17 18:01:04 +00:00
|
|
|
*/
|
2019-01-23 14:48:50 +00:00
|
|
|
class CubeBlockInputStream : public IBlockInputStream
|
2018-09-17 18:01:04 +00:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
using ExpressionActionsPtr = std::shared_ptr<ExpressionActions>;
|
|
|
|
using AggregateColumns = std::vector<ColumnRawPtrs>;
|
|
|
|
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;
|
2018-09-17 19:16:51 +00:00
|
|
|
UInt32 mask = 0;
|
2018-09-17 18:01:04 +00:00
|
|
|
Block source_block;
|
2018-09-20 15:46:37 +00:00
|
|
|
Block zero_block;
|
2018-09-17 18:01:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|