diff --git a/dbms/include/DB/Storages/MergeTree/MergeTreeWhereOptimizer.h b/dbms/include/DB/Storages/MergeTree/MergeTreeWhereOptimizer.h index 0a084e4610b..826b5606a29 100644 --- a/dbms/include/DB/Storages/MergeTree/MergeTreeWhereOptimizer.h +++ b/dbms/include/DB/Storages/MergeTree/MergeTreeWhereOptimizer.h @@ -86,8 +86,8 @@ private: /// remove condition by swapping it with the last one and calling ::pop_back() const auto remove_condition_at_index = [&conditions] (const std::size_t idx) { - if (idx < conditions.size()) - conditions[idx] = std::move(conditions.back()); + if (idx < conditions.size() - 1) + std::swap(conditions[idx], conditions.back()); conditions.pop_back(); }; diff --git a/dbms/src/Interpreters/ExpressionAnalyzer.cpp b/dbms/src/Interpreters/ExpressionAnalyzer.cpp index 264d76c8f00..c2c61297ade 100644 --- a/dbms/src/Interpreters/ExpressionAnalyzer.cpp +++ b/dbms/src/Interpreters/ExpressionAnalyzer.cpp @@ -459,7 +459,7 @@ void ExpressionAnalyzer::optimizeGroupBy() const auto remove_expr_at_index = [&group_exprs] (const size_t idx) { if (idx < group_exprs.size() - 1) - group_exprs[idx] = std::move(group_exprs.back()); + std::swap(group_exprs[idx], group_exprs.back()); group_exprs.pop_back(); };