aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/aggregate/aggregate_inmem_distinct_list.sql
blob: 5ea0b2283e75182fd4f72f9dea3f0bf59168cd8e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* syntax version 1 */
/* postgres can not */
select listlength(aggregate_list(distinct x)) as c from (
select AsList(1,2) as x 
union all
select AsList(1,3) as x 
union all
select AsList(1,2) as x 
);

select count(distinct x) as c from (
select AsList(1,2) as x 
union all
select AsList(1,3) as x 
union all
select AsList(1,2) as x 
);

select x,count(distinct y) as c from (
select AsList(1,2) as x,AsList(4) as y 
union all
select AsList(1,3) as x,AsList(4) as y 
union all
select AsList(1,3) as x,AsList(4) as y 
union all
select AsList(1,3) as x,AsList(4) as y 
union all
select AsList(1,2) as x,AsList(5) as y 
union all
select AsList(1,2) as x,AsList(5) as y 
) group by x
order by c;