ClickHouse/dbms/src/DataStreams/MergingAggregatedBlockInputStream.cpp

37 lines
728 B
C++
Raw Normal View History

#include <Columns/ColumnsNumber.h>
2012-05-30 01:38:02 +00:00
#include <DataStreams/MergingAggregatedBlockInputStream.h>
2012-05-30 01:38:02 +00:00
namespace DB
{
Block MergingAggregatedBlockInputStream::readImpl()
{
if (!executed)
{
executed = true;
AggregatedDataVariants data_variants;
2015-04-16 14:27:56 +00:00
Aggregator::CancellationHook hook = [&]() { return this->isCancelled(); };
aggregator.setCancellationHook(hook);
2015-04-16 14:27:56 +00:00
aggregator.mergeStream(children.back(), data_variants, max_threads);
blocks = aggregator.convertToBlocks(data_variants, final, max_threads);
it = blocks.begin();
}
Block res;
if (isCancelled() || it == blocks.end())
return res;
res = std::move(*it);
++it;
return res;
2012-05-30 01:38:02 +00:00
}
}