mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Small fixup.
This commit is contained in:
parent
a7c3acd90c
commit
e81c5171b7
@ -114,31 +114,15 @@ void QueryAliasesMatcher<T>::visit(const ASTSubquery & const_subquery, const AST
|
||||
subquery.prefer_alias_to_column_name = true;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool QueryAliasesMatcher<T>::checkIfNamesAreSame(Data & data, const ASTPtr & ast)
|
||||
{
|
||||
String name = ast->getColumnName();
|
||||
for (const auto & obj : data)
|
||||
{
|
||||
if (obj.second->getColumnName() == name)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void QueryAliasesMatcher<T>::visitOther(const ASTPtr & ast, Data & data)
|
||||
{
|
||||
auto & aliases = data;
|
||||
String alias = ast->tryGetAlias();
|
||||
|
||||
if (!alias.empty())
|
||||
{
|
||||
if (aliases.contains(alias) && ast->getTreeHash(/*ignore_aliases=*/ true) != aliases[alias]->getTreeHash(/*ignore_aliases=*/ true))
|
||||
{
|
||||
if (checkIfNamesAreSame(aliases, ast))
|
||||
throw Exception(wrongAliasMessage(ast, aliases[alias], alias), ErrorCodes::MULTIPLE_EXPRESSIONS_FOR_ALIAS);
|
||||
}
|
||||
|
||||
aliases[alias] = ast;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user