Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cookie page_num,
- 1234 1
- 1234 2
- 1234 3
- 1234 4
- 4444 1
- 4444 2
- select cookie, collect_set(page_num) as page_set
- from mytable
- group by cookie
- 1234 [1,2,3,4]
- 4444 [1,2]
- 1234 [2,4,1,3]
- 4444 [2,1]
- SELECT cookie, map_keys(
- collect_max( page_num, row_order, MAX_NUM_PAGES ) )
- FROM (
- SELECT cookie, page_num, group_count( cookie ) as row_order
- FROM mutable
- DISTRIBUTE BY cookie
- SORT BY cookie, my_sort_column
- ) sc
- GROUP BY cookie;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement