mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
Prevent going beyond the index of const_columns_to_remove.
This commit is contained in:
parent
067e3caa2c
commit
84f6a7336c
@ -38,11 +38,12 @@ FinishSortingTransform::FinishSortingTransform(
|
|||||||
/// Remove constants from description_sorted_.
|
/// Remove constants from description_sorted_.
|
||||||
SortDescription description_sorted_without_constants;
|
SortDescription description_sorted_without_constants;
|
||||||
description_sorted_without_constants.reserve(description_sorted_.size());
|
description_sorted_without_constants.reserve(description_sorted_.size());
|
||||||
|
size_t num_columns = const_columns_to_remove.size();
|
||||||
for (const auto & column_description : description_sorted_)
|
for (const auto & column_description : description_sorted_)
|
||||||
{
|
{
|
||||||
auto pos = header.getPositionByName(column_description.column_name);
|
auto pos = header.getPositionByName(column_description.column_name);
|
||||||
|
|
||||||
if (!const_columns_to_remove[pos]){
|
if (pos < num_columns && !const_columns_to_remove[pos]){
|
||||||
description_sorted_without_constants.push_back(column_description);
|
description_sorted_without_constants.push_back(column_description);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user