aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/aggr_factory/container.sql
blob: 303e3035f16bb9913ea213ca1882c7bce1e2cf69 (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/* syntax version 1 */
/* postgres can not */
$factory = AGGREGATION_FACTORY("sum");

select ListAggregate(ListCreate(Int32), $factory);
select ListAggregate(AsList(1, 2, 3), $factory);
select ListAggregate(Just(AsList(1, 2, 3)), $factory);
select ListAggregate(Nothing(ParseType("List<Int32>?")), $factory);

$factory = AGGREGATION_FACTORY("count");

select ListAggregate(ListCreate(Int32), $factory);
select ListAggregate(AsList(1, 2, 3), $factory);
select ListAggregate(Just(AsList(1, 2, 3)), $factory);
select ListAggregate(Nothing(ParseType("List<Int32>?")), $factory);

$factory = AGGREGATION_FACTORY("sum");

select ListSort(DictItems(DictAggregate(
    DictCreate(ParseType("String"), ParseType("List<Int32>"))
    , $factory)));

select ListSort(DictItems(DictAggregate(
    AsDict(
        AsTuple("foo", AsList(1, 3)), 
        AsTuple("bar", AsList(2))
    ), $factory)));


select ListSort(DictItems(DictAggregate(
    Just(AsDict(
        AsTuple("foo", AsList(1, 3)), 
        AsTuple("bar", AsList(2))
    )), $factory)));

select ListSort(DictItems(DictAggregate(
    Nothing(ParseType("Dict<String, List<Int32>>?"))
    , $factory)));

$factory = AGGREGATION_FACTORY("count");

select ListSort(DictItems(DictAggregate(
    DictCreate(ParseType("String"), ParseType("List<Int32>"))
    , $factory)));

select ListSort(DictItems(DictAggregate(
    AsDict(
        AsTuple("foo", AsList(1, 3)), 
        AsTuple("bar", AsList(2))
    ), $factory)));


select ListSort(DictItems(DictAggregate(
    Just(AsDict(
        AsTuple("foo", AsList(1, 3)), 
        AsTuple("bar", AsList(2))
    )), $factory)));

select ListSort(DictItems(DictAggregate(
    Nothing(ParseType("Dict<String, List<Int32>>?"))
    , $factory)));