aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/aggr_factory/count_if.sql
blob: a3dbd155b0adc9bf8aef12adb34057f8e422b6bb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
/* syntax version 1 */
/* postgres can not */
$t = AsList(AsStruct(true as a),AsStruct(false as a));
$f = AGGREGATION_FACTORY("countif");

select Yql::Aggregate($t, AsTuple(), AsTuple(AsTuple(AsAtom("res"), $f(
    ListItemType(TypeOf($t)), ($z)->{return $z.a}))));

use plato;
insert into @a select * from as_table($t);
commit;
select AGGREGATE_BY(a,$f) from @a;
select AGGREGATE_BY(distinct a,$f) from @a;