mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-17 13:13:36 +00:00
Fix tests and change pipeline
This commit is contained in:
parent
63b3d7dbdb
commit
23a8efe367
@ -1464,6 +1464,8 @@ void InterpreterSelectQuery::executeOrder(Pipeline & pipeline, SelectQueryInfo &
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (need_sorting)
|
if (need_sorting)
|
||||||
|
{
|
||||||
|
if (!prefix_order_descr.empty())
|
||||||
{
|
{
|
||||||
pipeline.transform([&](auto & stream)
|
pipeline.transform([&](auto & stream)
|
||||||
{
|
{
|
||||||
@ -1475,15 +1477,27 @@ void InterpreterSelectQuery::executeOrder(Pipeline & pipeline, SelectQueryInfo &
|
|||||||
limit);
|
limit);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pipeline.transform([&](auto & stream)
|
||||||
|
{
|
||||||
|
auto sorting_stream = std::make_shared<PartialSortingBlockInputStream>(stream, order_descr, limit);
|
||||||
|
|
||||||
|
/// Limits on sorting
|
||||||
|
IBlockInputStream::LocalLimits limits;
|
||||||
|
limits.mode = IBlockInputStream::LIMITS_TOTAL;
|
||||||
|
limits.size_limits = SizeLimits(settings.max_rows_to_sort, settings.max_bytes_to_sort, settings.sort_overflow_mode);
|
||||||
|
sorting_stream->setLimits(limits);
|
||||||
|
|
||||||
|
stream = sorting_stream;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// in order to read blocks in fixed order
|
// in order to read blocks in fixed order
|
||||||
query_info.do_not_steal_task = true;
|
query_info.do_not_steal_task = true;
|
||||||
if (order_direction == -1)
|
if (order_direction == -1)
|
||||||
{
|
{
|
||||||
pipeline.transform([&](auto & stream)
|
|
||||||
{
|
|
||||||
stream = std::make_shared<AsynchronousBlockInputStream>(stream);
|
|
||||||
});
|
|
||||||
pipeline.transform([&](auto & stream)
|
pipeline.transform([&](auto & stream)
|
||||||
{
|
{
|
||||||
stream = std::make_shared<ReverseBlockInputStream>(stream);
|
stream = std::make_shared<ReverseBlockInputStream>(stream);
|
||||||
@ -1499,9 +1513,11 @@ void InterpreterSelectQuery::executeOrder(Pipeline & pipeline, SelectQueryInfo &
|
|||||||
if (settings.optimize_pk_order)
|
if (settings.optimize_pk_order)
|
||||||
{
|
{
|
||||||
if (const auto * merge_tree = dynamic_cast<const MergeTreeData *>(storage.get()))
|
if (const auto * merge_tree = dynamic_cast<const MergeTreeData *>(storage.get()))
|
||||||
|
{
|
||||||
optimize_pk_order(*merge_tree);
|
optimize_pk_order(*merge_tree);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pipeline.transform([&](auto & stream)
|
pipeline.transform([&](auto & stream)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user