hql-行列转换

来源:互联网 发布:淘宝认证照片 编辑:程序博客网 时间:2024/06/06 15:49

行转列
hive -e ”
select id,word
from (
select ‘123’ as id,’java,c,php’ words from file_cto_user limit 1
) ta
lateral view explode(split(words,’,’)) uu as word

列转行
hive -e ”
select ubi.id,ubi.name, concat_ws(‘,’, collect_set(ua.address)) as address
from user_basic_info ubi
join user_address ua
on ubi.name=ua.name group by ubi.name;

原创粉丝点击