This commit is contained in:
Marina Samuel 2021-12-15 12:18:00 -05:00
Родитель 6cac92056b
Коммит b906dafe00
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -8,7 +8,7 @@ INT64, NUMERIC, and FLOAT64.
*/
CREATE OR REPLACE FUNCTION map.sum(entries ANY TYPE) AS (
ARRAY(SELECT AS STRUCT key, SUM(value) AS value FROM UNNEST(entries) GROUP BY key)
ARRAY(SELECT AS STRUCT key, SUM(value) AS value FROM UNNEST(entries) GROUP BY key ORDER BY key)
);
-- Tests
@ -31,5 +31,5 @@ SELECT
(NULL, 1)
]
),
ARRAY<STRUCT<key BOOL, value INT64>>[(TRUE, 3), (FALSE, NULL), (NULL, 1)]
ARRAY<STRUCT<key BOOL, value INT64>>[(NULL, 1), (FALSE, NULL), (TRUE, 3)]
);