aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/aggr_factory/flatten.sql
blob: e4b8be9bcea621906e2f75afcec3904a8ac0f4a9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* syntax version 1 */
/* postgres can not */
$f = AGGREGATION_FACTORY("sum");
$g = AggregateFlatten($f);
select
  ListAggregate([1,2,3], $f),
  ListAggregate(ListCreate(List<Int32>), $g),
  ListAggregate([ListCreate(Int32)], $g),
  ListAggregate([ListCreate(Int32),ListCreate(Int32)], $g),
  ListAggregate([[1,2]], $g),
  ListAggregate([[1,2],[3]], $g),
  ListAggregate([ListCreate(Int32),[3]], $g),
  ListAggregate([[1,2],ListCreate(Int32)], $g);

$i = AGGREGATION_FACTORY("AGGREGATE_LIST_DISTINCT");
$j = AggregateFlatten($i);
select AggregateBy(x, $j) from (
   select [1,2] as x 
   union all
   select [2,3] as x
);