赞
踩
目录
select split(concat_ws(',',array("AAA", "bbb"), array('CCC',"AAA", "bbb"), array("GGG","CCC")), ",")
hive> select split(concat_ws(',',array("AAA", "bbb"), array('CCC',"AAA", "bbb"), array("GGG","CCC")), ",");
OK
["AAA","bbb","CCC","AAA","bbb","GGG","CCC"]
Time taken: 0.291 seconds, Fetched: 1 row(s)
select concat_ws(',',array("AAA", "bbb"), array('CCC',"AAA", "bbb"), array("GGG","CCC"))
hive> select concat_ws(',',array("AAA", "bbb"), array('CCC',"AAA", "bbb"), array("GGG","CCC"));
OK
AAA,bbb,CCC,AAA,bbb,GGG,CCC
Time taken: 0.456 seconds, Fetched: 1 row(s)
select split(concat_ws(',',array("AAA", "bbb"), array('CCC',"AAA", "bbb"), array("GGG","CCC")), ",")
select
l1,split(concat_ws(',',collect_set(concat_ws(',',l2))),',')
from
(
select 666 l1,array("AAA", "bbb") l2
union
select 666 l1,array('CCC',"AAA", "bbb") l2
union
select 666 l1,array("AAABB", "bbbFF","AAAEE", "bbbFF") l2
union
select 666 l1,array("AATTA", "bbTb") l2
) res
group by l1
结果和上面效果一样
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。