mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 17:12:03 +00:00
Merge pull request #52135 from ucasfl/alias
Add array_agg as alias of groupArray for PostgreSQL compatibility
This commit is contained in:
commit
9e7361a0f6
@ -44,3 +44,5 @@ Result:
|
||||
```
|
||||
|
||||
The groupArray function will remove ᴺᵁᴸᴸ value based on the above results.
|
||||
|
||||
- Alias: `array_agg`.
|
||||
|
@ -125,6 +125,7 @@ void registerAggregateFunctionGroupArray(AggregateFunctionFactory & factory)
|
||||
AggregateFunctionProperties properties = { .returns_default_when_only_null = false, .is_order_dependent = true };
|
||||
|
||||
factory.registerFunction("groupArray", { createAggregateFunctionGroupArray<false>, properties });
|
||||
factory.registerAlias("array_agg", "groupArray", AggregateFunctionFactory::CaseInsensitive);
|
||||
factory.registerFunction("groupArraySample", { createAggregateFunctionGroupArraySample, properties });
|
||||
factory.registerFunction("groupArrayLast", { createAggregateFunctionGroupArray<true>, properties });
|
||||
}
|
||||
|
6
tests/queries/0_stateless/02813_array_agg.reference
Normal file
6
tests/queries/0_stateless/02813_array_agg.reference
Normal file
@ -0,0 +1,6 @@
|
||||
['hello, world!','hello, world!','hello, world!','hello, world!','hello, world!']
|
||||
['hello, world!']
|
||||
['hello, world!']
|
||||
['hello, world!']
|
||||
['hello, world!']
|
||||
['hello, world!']
|
10
tests/queries/0_stateless/02813_array_agg.sql
Normal file
10
tests/queries/0_stateless/02813_array_agg.sql
Normal file
@ -0,0 +1,10 @@
|
||||
drop table if exists t;
|
||||
create table t (n Int32, s String) engine=MergeTree order by n;
|
||||
|
||||
insert into t select number, 'hello, world!' from numbers (5);
|
||||
|
||||
select array_agg(s) from t;
|
||||
|
||||
select aRray_Agg(s) from t group by n;
|
||||
|
||||
drop table t;
|
Loading…
Reference in New Issue
Block a user