dbms: fixed error [#METR-17536].

This commit is contained in:
Alexey Milovidov 2015-09-15 00:09:33 +03:00
parent 2318e27485
commit 9e8b28131e
2 changed files with 4 additions and 4 deletions

View File

@ -100,9 +100,9 @@ public:
arenas.push_back(arena_); arenas.push_back(arena_);
} }
ColumnPtr convertToValues() ColumnPtr convertToValues() const
{ {
IAggregateFunction * function = holder->func; const IAggregateFunction * function = holder->func;
ColumnPtr res = function->getReturnType()->createColumn(); ColumnPtr res = function->getReturnType()->createColumn();
IColumn & column = *res; IColumn & column = *res;
res->reserve(getData().size()); res->reserve(getData().size());

View File

@ -1756,7 +1756,7 @@ Block Aggregator::mergeBlocks(BlocksList & blocks, bool final)
for (const auto & block : merged_blocks) for (const auto & block : merged_blocks)
{ {
if (block && !block.info.is_overflows) if (block && block.rowsInFirstColumn() && !block.info.is_overflows)
has_nonempty_nonoverflows = true; has_nonempty_nonoverflows = true;
else if (block.info.is_overflows) else if (block.info.is_overflows)
has_overflows = true; has_overflows = true;
@ -1777,7 +1777,7 @@ Block Aggregator::mergeBlocks(BlocksList & blocks, bool final)
{ {
for (auto it = merged_blocks.begin(); it != merged_blocks.end(); ++it) for (auto it = merged_blocks.begin(); it != merged_blocks.end(); ++it)
{ {
if (!*it) if (!*it || it->rowsInFirstColumn() == 0)
{ {
merged_blocks.erase(it); merged_blocks.erase(it);
break; break;