Last active
March 28, 2020 13:19
-
-
Save steve-ng/dcaed9eaae8f208901adfb9a19128f5d to your computer and use it in GitHub Desktop.
medium post
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
/* Assume the table is called order on Athena */ | |
SELECT | |
"item category", | |
reduce(kv1['Asia Pacific'], 0.0, (s, x) -> s + x, s-> s) AS "Asia Pacific", | |
reduce(kv1['North America'], 0.0, (s, x) -> s + x, s-> s) AS "North America" | |
FROM ( | |
SELECT | |
"item category", | |
multimap_agg("region", amount) kv1 | |
FROM order | |
GROUP BY "item category" | |
) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment