From 24d462b0182ce6328509581caf53674d7b94d276 Mon Sep 17 00:00:00 2001 From: Nikolai Kochetov Date: Mon, 11 Jan 2021 19:15:03 +0300 Subject: [PATCH] Try to remove ActionsDAG::removeColumn --- src/Interpreters/ActionsDAG.cpp | 6 ------ src/Interpreters/ActionsDAG.h | 12 ------------ src/Interpreters/ExpressionAnalyzer.cpp | 17 ----------------- 3 files changed, 35 deletions(-) diff --git a/src/Interpreters/ActionsDAG.cpp b/src/Interpreters/ActionsDAG.cpp index 2fc78261f17..c7fc284d8bf 100644 --- a/src/Interpreters/ActionsDAG.cpp +++ b/src/Interpreters/ActionsDAG.cpp @@ -436,12 +436,6 @@ void ActionsDAG::project(const NamesWithAliases & projection) settings.projected_output = true; } -void ActionsDAG::removeColumn(const std::string & column_name) -{ - auto & node = getNode(column_name); - index.remove(&node); -} - bool ActionsDAG::tryRestoreColumn(const std::string & column_name) { if (index.contains(column_name)) diff --git a/src/Interpreters/ActionsDAG.h b/src/Interpreters/ActionsDAG.h index a0ac210e752..aad6d335eec 100644 --- a/src/Interpreters/ActionsDAG.h +++ b/src/Interpreters/ActionsDAG.h @@ -133,16 +133,6 @@ public: insert(node); } - void remove(Node * node) - { - auto it = map.find(node->result_name); - if (it != map.end()) - return; - - list.erase(it->second); - map.erase(it); - } - void remove(std::list::iterator it) { auto map_it = map.find((*it)->result_name); @@ -219,8 +209,6 @@ public: /// Add alias actions and remove unused columns from index. Also specify result columns order in index. void project(const NamesWithAliases & projection); - /// Removes column from index. - void removeColumn(const std::string & column_name); /// If column is not in index, try to find it in nodes and insert back into index. bool tryRestoreColumn(const std::string & column_name); diff --git a/src/Interpreters/ExpressionAnalyzer.cpp b/src/Interpreters/ExpressionAnalyzer.cpp index a80b7799a98..ae1aa1a0bb1 100644 --- a/src/Interpreters/ExpressionAnalyzer.cpp +++ b/src/Interpreters/ExpressionAnalyzer.cpp @@ -1489,23 +1489,6 @@ void ExpressionAnalysisResult::finalize(const ExpressionActionsChain & chain, si columns_to_remove.insert(step.required_output[i]); } - if (!columns_to_remove.empty()) - { - auto columns = prewhere_info->prewhere_actions->getResultColumns(); - - auto remove_actions = std::make_shared(); - for (const auto & column : columns) - { - if (columns_to_remove.count(column.name)) - { - remove_actions->addInput(column); - remove_actions->removeColumn(column.name); - } - } - - prewhere_info->remove_columns_actions = std::move(remove_actions); - } - columns_to_remove_after_prewhere = std::move(columns_to_remove); } else if (hasFilter())