mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
fix duplicated any function rewrite (#13419)
This commit is contained in:
parent
cece629145
commit
e05dc65e73
@ -14,7 +14,7 @@ namespace DB
|
||||
namespace
|
||||
{
|
||||
|
||||
bool extractIdentifiers(const ASTFunction & func, std::vector<ASTPtr *> & identifiers)
|
||||
bool extractIdentifiers(const ASTFunction & func, std::unordered_set<ASTPtr *> & identifiers)
|
||||
{
|
||||
for (auto & arg : func.arguments->children)
|
||||
{
|
||||
@ -30,7 +30,7 @@ bool extractIdentifiers(const ASTFunction & func, std::vector<ASTPtr *> & identi
|
||||
return false;
|
||||
}
|
||||
else if (arg->as<ASTIdentifier>())
|
||||
identifiers.emplace_back(&arg);
|
||||
identifiers.emplace(&arg);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -67,7 +67,7 @@ void RewriteAnyFunctionMatcher::visit(const ASTFunction & func, ASTPtr & ast, Da
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<ASTPtr *> identifiers;
|
||||
std::unordered_set<ASTPtr *> identifiers; /// implicit remove duplicates
|
||||
if (!extractIdentifiers(func, identifiers))
|
||||
return;
|
||||
|
||||
|
@ -0,0 +1 @@
|
||||
1
|
@ -0,0 +1 @@
|
||||
SELECT any(if(if(x, 1, 2) AS a_, a_, 0)) FROM (SELECT 1 AS x);
|
Loading…
Reference in New Issue
Block a user