Hive 对array/数组 字段 排序
Posted 二十六画生的博客
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Hive 对array/数组 字段 排序相关的知识,希望对你有一定的参考价值。
Hive 数组排序
SELECT
memberid,
collect_list(cast(airways as string)),
concat_ws(',', collect_list(cast(airways as string))),
sort_array(collect_list(cast(airways as string)))
from
(
select
1 as memberid,
'A' as airways,
3 as legcount
union ALL
select
1 as memberid,
'B' as airways,
2 as legcount
union ALL
select
1 as memberid,
'D' as airways,
1 as legcount
union ALL
select
1 as memberid,
'C' as airways,
4 as legcount
union ALL
select
2 as memberid,
'D' as airways,
3 as legcount
union ALL
select
2 as memberid,
'C' as airways,
4 as legcount
) as t
group by
memberid;
结果:
end
以上是关于Hive 对array/数组 字段 排序的主要内容,如果未能解决你的问题,请参考以下文章