2019-03-19 13:36:19 +00:00
|
|
|
#pragma once
|
|
|
|
#include <Processors/IInflatingTransform.h>
|
|
|
|
#include <Processors/Transforms/AggregatingTransform.h>
|
2022-05-18 21:37:43 +00:00
|
|
|
#include <Processors/Transforms/finalizeChunk.h>
|
2019-03-19 13:36:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
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;
|
2022-06-27 11:16:52 +00:00
|
|
|
ColumnNumbers keys;
|
2022-05-18 21:37:43 +00:00
|
|
|
const ColumnsMask aggregates_mask;
|
2019-03-19 13:36:19 +00:00
|
|
|
|
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;
|
2022-05-16 17:33:38 +00:00
|
|
|
UInt64 grouping_set = 0;
|
2019-08-22 09:28:23 +00:00
|
|
|
|
|
|
|
Chunk merge(Chunks && chunks, bool final);
|
2019-03-19 13:36:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|