mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Merge pull request #12593 from CurtizJ/fix-any-with-aliases
Fix lack of aliases with function 'any'
This commit is contained in:
commit
e4e642e24f
@ -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