ClickHouse/src/Processors/Transforms/CubeTransform.h

36 lines
814 B
C++
Raw Normal View History

2019-03-19 13:36:19 +00:00
#pragma once
#include <Processors/IInflatingTransform.h>
#include <Processors/Transforms/AggregatingTransform.h>
namespace DB
{
/// Takes blocks after grouping, with non-finalized aggregate functions.
/// Calculates all subsets of columns and aggregates over them.
2019-08-22 09:28:23 +00:00
class CubeTransform : public IAccumulatingTransform
2019-03-19 13:36:19 +00:00
{
public:
CubeTransform(Block header, AggregatingTransformParamsPtr params);
2019-04-05 10:52:07 +00:00
String getName() const override { return "CubeTransform"; }
2019-03-19 13:36:19 +00:00
protected:
void consume(Chunk chunk) override;
Chunk generate() override;
private:
AggregatingTransformParamsPtr params;
ColumnNumbers keys;
2019-08-22 09:28:23 +00:00
Chunks consumed_chunks;
Chunk cube_chunk;
2019-03-19 13:36:19 +00:00
Columns current_columns;
Columns current_zero_columns;
UInt64 mask = 0;
2019-08-22 09:28:23 +00:00
Chunk merge(Chunks && chunks, bool final);
2019-03-19 13:36:19 +00:00
};
}