hive中同列多行数据组合的方法以及array to string要点(行转列)
1. 同列多行数据组合成一个字段cell的方法, top N 问题的hive方案 如下: hive 列转行 to json与to array list set等复杂结构,hive topN的提取的窗口统计方法 select ll, collect_list(n) , -- 将topN 转换成 List or Json with the help of collect_set(xx) collect_list(xx) collect_list(nn), collect_list(ll), collect_list(dd) from ( select concat('\'', n, '\'') as nn, n , ll , concat_ws(":", concat('\\\'', n, '\\\''), ll) as dd , row_number() over (partition by ll order by n desc ) as num1 -- 某用户的所有文章点击率排序 from ( select 1 as n, '4' as ll UNION all SELECT 2 as...
