mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-17 20:02:05 +00:00
fix lack of aliases with function 'any'
This commit is contained in:
parent
b8cc2bee53
commit
d4783f8f19
@ -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);
|
||||
}
|
||||
|
8
tests/queries/0_stateless/01398_any_with_alias.reference
Normal file
8
tests/queries/0_stateless/01398_any_with_alias.reference
Normal 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)
|
5
tests/queries/0_stateless/01398_any_with_alias.sql
Normal file
5
tests/queries/0_stateless/01398_any_with_alias.sql
Normal 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);
|
Loading…
Reference in New Issue
Block a user