Merge pull request #52147 from ucasfl/any_value

Add any_value as a compatibility alias for any
This commit is contained in:
robot-ch-test-poll 2023-07-25 13:05:49 +02:00 committed by GitHub
commit 8964de808e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 0 deletions

View File

@ -12,3 +12,5 @@ To get a determinate result, you can use the min or max function ins
In some cases, you can rely on the order of execution. This applies to cases when SELECT comes from a subquery that uses ORDER BY.
When a `SELECT` query has the `GROUP BY` clause or at least one aggregate function, ClickHouse (in contrast to MySQL) requires that all expressions in the `SELECT`, `HAVING`, and `ORDER BY` clauses be calculated from keys or from aggregate functions. In other words, each column selected from the table must be used either in keys or inside aggregate functions. To get behavior like in MySQL, you can put the other columns in the `any` aggregate function.
- Alias: `any_value`

View File

@ -49,6 +49,7 @@ void registerAggregateFunctionsAny(AggregateFunctionFactory & factory)
AggregateFunctionProperties properties = { .returns_default_when_only_null = false, .is_order_dependent = true };
factory.registerFunction("any", { createAggregateFunctionAny, properties });
factory.registerAlias("any_value", "any", AggregateFunctionFactory::CaseInsensitive);
factory.registerFunction("anyLast", { createAggregateFunctionAnyLast, properties });
factory.registerFunction("anyHeavy", { createAggregateFunctionAnyHeavy, properties });

View File

@ -0,0 +1,2 @@
0
0

View File

@ -0,0 +1,3 @@
SET max_block_size = 10, max_threads = 1;
select any_value(number) from numbers(10);
select aNy_VaLue(number) from numbers(10);