mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 00:22:29 +00:00
Fix: correct sort description for ReadFromMergeTree with read in order
optimization
This commit is contained in:
parent
560bc2bc22
commit
e888859396
@ -48,6 +48,8 @@ struct SortColumnDescription
|
||||
bool with_fill;
|
||||
FillColumnDescription fill_description;
|
||||
|
||||
SortColumnDescription() = default;
|
||||
|
||||
explicit SortColumnDescription(
|
||||
const std::string & column_name_,
|
||||
int direction_ = 1,
|
||||
|
@ -143,7 +143,12 @@ ReadFromMergeTree::ReadFromMergeTree(
|
||||
{
|
||||
auto const & settings = context->getSettingsRef();
|
||||
if ((settings.optimize_read_in_order || settings.optimize_aggregation_in_order) && query_info.getInputOrderInfo())
|
||||
{
|
||||
output_stream->sort_scope = DataStream::SortScope::Stream;
|
||||
const auto used_prefix_of_sorting_key_size = query_info.getInputOrderInfo()->used_prefix_of_sorting_key_size;
|
||||
if (sort_description.size() > used_prefix_of_sorting_key_size)
|
||||
sort_description.resize(used_prefix_of_sorting_key_size);
|
||||
}
|
||||
else
|
||||
output_stream->sort_scope = DataStream::SortScope::Chunk;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user