fix lack of aliases with function 'any'

This commit is contained in:
Anton Popov 2020-07-20 12:02:07 +03:00
parent b8cc2bee53
commit d4783f8f19
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);