mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-19 14:11:58 +00:00
41 lines
943 B
C++
41 lines
943 B
C++
#pragma once
|
|
|
|
#include <Interpreters/Aggregator.h>
|
|
#include <DataStreams/IBlockInputStream.h>
|
|
|
|
|
|
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 MergingAggregatedBlockInputStream : public IBlockInputStream
|
|
{
|
|
public:
|
|
MergingAggregatedBlockInputStream(const BlockInputStreamPtr & input, const Aggregator::Params & params, bool final_, size_t max_threads_)
|
|
: aggregator(params), final(final_), max_threads(max_threads_)
|
|
{
|
|
children.push_back(input);
|
|
}
|
|
|
|
String getName() const override { return "MergingAggregated"; }
|
|
|
|
Block getHeader() const override;
|
|
|
|
protected:
|
|
Block readImpl() override;
|
|
|
|
private:
|
|
Aggregator aggregator;
|
|
bool final;
|
|
size_t max_threads;
|
|
|
|
bool executed = false;
|
|
BlocksList blocks;
|
|
BlocksList::iterator it;
|
|
};
|
|
|
|
}
|