mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 10:02:01 +00:00
Merge pull request #52147 from ucasfl/any_value
Add any_value as a compatibility alias for any
This commit is contained in:
commit
8964de808e
@ -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`
|
||||
|
@ -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 });
|
||||
|
||||
|
2
tests/queries/0_stateless/02813_any_value.reference
Normal file
2
tests/queries/0_stateless/02813_any_value.reference
Normal file
@ -0,0 +1,2 @@
|
||||
0
|
||||
0
|
3
tests/queries/0_stateless/02813_any_value.sql
Normal file
3
tests/queries/0_stateless/02813_any_value.sql
Normal 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);
|
Loading…
Reference in New Issue
Block a user