Last active
August 11, 2021 13:06
-
-
Save darkjh/72710709644766a543efd0595fb095d4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH aggregated_metrics AS ( | |
SELECT arbitrary(pop) AS pop, arbitrary(idx) AS idx, SUM(m) as m | |
FROM ( | |
VALUES | |
(1, ARRAY[2, 5, 7]), | |
(2, ARRAY[45, 8, 7]), | |
(1, ARRAY[100, 0, 3]) | |
) AS log (pop, metric) | |
CROSS JOIN UNNEST(metric) WITH ORDINALITY AS t (m, idx) | |
GROUP BY pop, idx | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment