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
|
|
|
|
{
|
|
|
|
|
2018-02-18 03:23:48 +00:00
|
|
|
Block MergingAggregatedBlockInputStream::getHeader() const
|
2018-01-06 18:10:44 +00:00
|
|
|
{
|
|
|
|
return aggregator.getHeader(final);
|
|
|
|
}
|
|
|
|
|
2012-05-30 01:38:02 +00:00
|
|
|
|
|
|
|
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;
|
2018-03-05 21:09:39 +00:00
|
|
|
if (isCancelledOrThrowIfKilled() || it == blocks.end())
|
2017-04-01 07:20:54 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|