Try fix other tests.

This commit is contained in:
Nikolai Kochetov 2021-03-10 18:12:34 +03:00
parent 5ef5ec4e05
commit 3a050286f7

View File

@ -321,19 +321,24 @@ void ActionsDAG::removeUnusedActions(const NameSet & required_names)
void ActionsDAG::removeUnusedActions(const Names & required_names)
{
std::cerr << "ActionsDAG::removeUnusedActions\n";
NodeRawConstPtrs required_nodes;
required_nodes.reserve(required_names.size());
std::unordered_map<std::string_view, std::list<const Node *>> names_map;
for (const auto * node : index)
{
std::cerr << ".index " << node->result_name << std::endl;
names_map[node->result_name].push_back(node);
}
for (const auto & name : required_names)
{
std::cerr << "..req name " << name << std::endl;
auto & nodes_list = names_map[name];
if (nodes_list.empty())
throw Exception(ErrorCodes::UNKNOWN_IDENTIFIER,
"Unknown column: {}, there are only columns {}", name, dumpNames());
"Unknown column: {}, there are only columns {}", name, dumpDAG());
required_nodes.push_back(nodes_list.front());
nodes_list.pop_back();
@ -416,7 +421,7 @@ void ActionsDAG::addAliases(const NamesWithAliases & aliases, bool project)
"Unknown column: {}, there are only columns {}", item.first, dumpNames());
required_nodes.push_back(it->second);
alias_names.insert(item.second);
alias_names.insert(item.second.empty() ? item.first : item.second);
}
if (project)
@ -454,7 +459,7 @@ void ActionsDAG::addAliases(const NamesWithAliases & aliases, bool project)
auto & alias = addNode(std::move(node));
index.push_back(&alias);
}
else if (project)
else
index.push_back(child);
}
}