ClickHouse/dbms/src/DataStreams/MergingAggregatedBlockInputStream.cpp

42 lines
847 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::getHeader() const
{
return aggregator.getHeader(final);
}
2012-05-30 01:38:02 +00:00
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 (isCancelledOrThrowIfKilled() || it == blocks.end())
return res;
res = std::move(*it);
++it;
return res;
2012-05-30 01:38:02 +00:00
}
}