mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-04 13:32:13 +00:00
Update InterpreterSelectQuery.cpp
This commit is contained in:
parent
125fce3303
commit
e1158f53ad
@ -1432,7 +1432,7 @@ static SortDescription getSortDescription(const ASTSelectQuery & query)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InterpreterSelectQuery::executeOrder(Pipeline & pipeline, SelectQueryInfo& query_info)
|
void InterpreterSelectQuery::executeOrder(Pipeline & pipeline, SelectQueryInfo & query_info)
|
||||||
{
|
{
|
||||||
auto & query = getSelectQuery();
|
auto & query = getSelectQuery();
|
||||||
SortDescription order_descr = getSortDescription(query);
|
SortDescription order_descr = getSortDescription(query);
|
||||||
@ -1440,7 +1440,7 @@ void InterpreterSelectQuery::executeOrder(Pipeline & pipeline, SelectQueryInfo&
|
|||||||
UInt64 limit = getLimitForSorting(query, context);
|
UInt64 limit = getLimitForSorting(query, context);
|
||||||
const Settings & settings = context.getSettingsRef();
|
const Settings & settings = context.getSettingsRef();
|
||||||
|
|
||||||
const auto& order_direction = order_descr.at(0).direction;
|
const auto & order_direction = order_descr.at(0).direction;
|
||||||
|
|
||||||
auto optimize_pk_order = [&](auto & merge_tree)
|
auto optimize_pk_order = [&](auto & merge_tree)
|
||||||
{
|
{
|
||||||
@ -1456,7 +1456,8 @@ void InterpreterSelectQuery::executeOrder(Pipeline & pipeline, SelectQueryInfo&
|
|||||||
{
|
{
|
||||||
need_sorting = true;
|
need_sorting = true;
|
||||||
break;
|
break;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
prefix_order_descr.push_back(order_descr[i]);
|
prefix_order_descr.push_back(order_descr[i]);
|
||||||
}
|
}
|
||||||
@ -1497,13 +1498,8 @@ void InterpreterSelectQuery::executeOrder(Pipeline & pipeline, SelectQueryInfo&
|
|||||||
|
|
||||||
if (settings.optimize_pk_order)
|
if (settings.optimize_pk_order)
|
||||||
{
|
{
|
||||||
if (const StorageMergeTree * merge_tree = dynamic_cast<const StorageMergeTree *>(storage.get()))
|
if (const auto * merge_tree = dynamic_cast<const MergeTreeData *>(storage.get()))
|
||||||
{
|
|
||||||
optimize_pk_order(*merge_tree);
|
optimize_pk_order(*merge_tree);
|
||||||
} else if (const StorageReplicatedMergeTree * replicated_merge_tree = dynamic_cast<const StorageReplicatedMergeTree *>(storage.get()))
|
|
||||||
{
|
|
||||||
optimize_pk_order(*replicated_merge_tree);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user