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