Merge pull request #18953 from ClickHouse/try-to-remove-remove-from-actions-dag

Try to remove ActionsDAG::removeColumn
This commit is contained in:
alesapin 2021-01-12 10:22:09 +03:00 committed by GitHub
commit a7db584b36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 0 additions and 35 deletions

View File

@ -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))

View File

@ -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<Node *>::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);

View File

@ -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<ActionsDAG>();
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())