aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/select/to_dict.sql
blob: 7c1e8e85bd3c76e4126de3b3ca4bfa00ea75eb0c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/* postgres can not */
/* syntax version 1 */
SELECT
    key,
    ToDict(items) AS `dict`,
    ToMultiDict(items) AS multi_dict
FROM (
    SELECT
        key,
        AGGREGATE_LIST(AsTuple(subkey, value)) AS items
    FROM (
        SELECT * FROM plato.Input
        UNION ALL
        SELECT * FROM plato.Input
    ) GROUP BY key
)
ORDER BY key;