ClickHouse/src/Processors/Transforms/MergingAggregatedTransform.h

41 lines
1.1 KiB
C++
Raw Normal View History

2019-03-04 16:06:28 +00:00
#pragma once
#include <Processors/IAccumulatingTransform.h>
#include <Interpreters/Aggregator.h>
2019-03-15 17:06:32 +00:00
#include <Processors/Transforms/AggregatingTransform.h>
2019-03-04 16:06:28 +00:00
namespace DB
{
/** A pre-aggregate stream of blocks in which each block is already aggregated.
* Aggregate functions in blocks should not be finalized so that their states can be merged.
*/
class MergingAggregatedTransform : public IAccumulatingTransform
{
public:
2019-08-03 11:02:40 +00:00
MergingAggregatedTransform(Block header_, AggregatingTransformParamsPtr params_, size_t max_threads_);
2019-03-04 16:06:28 +00:00
String getName() const override { return "MergingAggregatedTransform"; }
protected:
void consume(Chunk chunk) override;
Chunk generate() override;
private:
2019-03-15 17:06:32 +00:00
AggregatingTransformParamsPtr params;
2020-05-30 21:57:37 +00:00
Poco::Logger * log = &Poco::Logger::get("MergingAggregatedTransform");
2019-03-04 16:06:28 +00:00
size_t max_threads;
AggregatedDataVariants data_variants;
Aggregator::BucketToBlocks bucket_to_blocks;
UInt64 total_input_rows = 0;
UInt64 total_input_blocks = 0;
BlocksList blocks;
BlocksList::iterator next_block;
bool consume_started = false;
bool generate_started = false;
};
}