Merge pull request #12593 from CurtizJ/fix-any-with-aliases

Fix lack of aliases with function 'any'
This commit is contained in:
alexey-milovidov 2020-07-21 14:37:37 +03:00 committed by GitHub
commit e4e642e24f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 0 deletions

View File

@ -71,10 +71,13 @@ void AnyInputMatcher::visit(ASTPtr & current_ast, Data data)
&& function_argument && function_argument->as<ASTFunction>())
{
auto name = function_node->name;
auto alias = function_node->alias;
///cut any or anyLast
if (!function_argument->as<ASTFunction>()->arguments->children.empty())
{
current_ast = function_argument->clone();
current_ast->setAlias(alias);
for (size_t i = 0; i < current_ast->as<ASTFunction>()->arguments->children.size(); ++i)
changeAllIdentifiers(current_ast, i, name);
}

View File

@ -0,0 +1,8 @@
"n"
0
SELECT any(number) * any(number) AS n
FROM numbers(100)
"n"
0,0
SELECT (any(number), any(number) * 2) AS n
FROM numbers(100)

View File

@ -0,0 +1,5 @@
SELECT any(number * number) AS n FROM numbers(100) FORMAT CSVWithNames;
EXPLAIN SYNTAX SELECT any(number * number) AS n FROM numbers(100);
SELECT any((number, number * 2)) as n FROM numbers(100) FORMAT CSVWithNames;
EXPLAIN SYNTAX SELECT any((number, number * 2)) as n FROM numbers(100);