数据:
a b 1
a b 2
a b 3
结果:
a b 1,2,3
处理过程:
create table tmp_test(col1 string,col2 string,col3 string)
select col1,col2,concat_ws(’,’,collect_set(col3)) from tmp_test group by col1,col2;
二、列转行
select col1,col2,col5 from tmp_test a lateral view explode(split(col3,’,’)) b AS col5;器