Try fix tests.

This commit is contained in:
Nikolai Kochetov 2020-03-19 20:18:33 +03:00
parent b6d7cb45dd
commit 175c95675b
2 changed files with 13 additions and 5 deletions

View File

@ -240,8 +240,7 @@ void TreeExecutorBlockInputStream::initRowsBeforeLimit()
if (auto * source = typeid_cast<SourceFromInputStream *>(processor))
sources.emplace_back(source);
}
if (auto * sorting = typeid_cast<PartialSortingTransform *>(processor))
else if (auto * sorting = typeid_cast<PartialSortingTransform *>(processor))
{
if (!rows_before_limit_at_least)
rows_before_limit_at_least = std::make_shared<RowsBeforeLimitCounter>();
@ -269,6 +268,11 @@ void TreeExecutorBlockInputStream::initRowsBeforeLimit()
for (auto & source : sources)
source->setRowsBeforeLimitCounter(rows_before_limit_at_least);
}
/// If there is a limit, then enable rows_before_limit_at_least
/// It is needed when zero rows is read, but we still want rows_before_limit_at_least in result.
if (!limit_transforms.empty())
rows_before_limit_at_least->add(0);
}
Block TreeExecutorBlockInputStream::readImpl()

View File

@ -592,8 +592,7 @@ void QueryPipeline::initRowsBeforeLimit()
if (auto * source = typeid_cast<SourceFromInputStream *>(processor))
sources.emplace_back(source);
}
if (auto * sorting = typeid_cast<PartialSortingTransform *>(processor))
else if (auto * sorting = typeid_cast<PartialSortingTransform *>(processor))
{
if (!rows_before_limit_at_least)
rows_before_limit_at_least = std::make_shared<RowsBeforeLimitCounter>();
@ -601,7 +600,7 @@ void QueryPipeline::initRowsBeforeLimit()
sorting->setRowsBeforeLimitCounter(rows_before_limit_at_least);
/// Don't go to children. Take rows_before_limit from last PartialSortingTransform.
/// continue;
continue;
}
/// Skip totals and extremes port for output format.
@ -633,6 +632,11 @@ void QueryPipeline::initRowsBeforeLimit()
source->setRowsBeforeLimitCounter(rows_before_limit_at_least);
}
/// If there is a limit, then enable rows_before_limit_at_least
/// It is needed when zero rows is read, but we still want rows_before_limit_at_least in result.
if (!limits.empty())
rows_before_limit_at_least->add(0);
if (rows_before_limit_at_least)
output_format->setRowsBeforeLimitCounter(rows_before_limit_at_least);
}