aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/s-expressions/suites/Aggregation/SameTrait.sql
blob: aaa89e48d5bbc90e694f78285cae768971705576 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
USE plato;

SELECT
    key as key,
    "a" || min(subkey || "q") as x1,
    "b" || min(subkey || "q") as x2,
    "c" || max(value) as x3,
    "d" || max(value) as x4,
    "1" || min(distinct subkey) as y1,
    "2" || min(distinct subkey) as y2,
    "3" || max(distinct value) as y3,
    "4" || max(distinct value) as y4,
    percentile(x, 0.5),
    percentile(x, 0.9)
FROM (SELECT key, subkey, value, Length(key) as x from Input)
GROUP BY key
ORDER BY key;