From 3225c7186c96fb1657f57bc7acbe03fb92066c04 Mon Sep 17 00:00:00 2001 From: Nikita Vasilev Date: Thu, 6 May 2021 23:36:18 +0300 Subject: [PATCH] fix --- src/Storages/MergeTree/SubstituteColumnOptimizer.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Storages/MergeTree/SubstituteColumnOptimizer.cpp b/src/Storages/MergeTree/SubstituteColumnOptimizer.cpp index d92b68564bc..83a52daf3e4 100644 --- a/src/Storages/MergeTree/SubstituteColumnOptimizer.cpp +++ b/src/Storages/MergeTree/SubstituteColumnOptimizer.cpp @@ -144,11 +144,12 @@ public: const auto * identifier = ast->as(); if (identifier && data.name_to_component_id.contains(identifier->name())) { - const auto & name = identifier->name(); + const String & name = identifier->name(); const auto component_id = data.name_to_component_id.at(name); - ast = data.id_to_expression_map.at(component_id)->clone(); + auto new_ast = data.id_to_expression_map.at(component_id)->clone(); if (data.is_select) - ast->setAlias(data.old_name.at(name)); + new_ast->setAlias(data.old_name.at(name)); + ast = new_ast; } }