hive列转行 (collect_set())
来源:互联网 发布:node.js哪些教程好 编辑:程序博客网 时间:2024/06/05 12:03
转载链接:http://my.oschina.net/dataRunner/blog/295960
一、问题
hive如何将
a b 1
a b 2
a b 3
c d 4
c d 5
c d 6
变为:
a b 1,2,3
c d 4,5,6
二、数据
test.txt
a b 1
a b 2
a b 3
c d 4
c d 5
c d 6
三、答案
1.建表
drop table tmp_jiangzl_test;
create table tmp_jiangzl_test
(
col1 string,
col2 string,
col3 string
)
row format delimited fields terminated by '\t'
stored as textfile;
load data local inpath '/home/jiangzl/shell/test.txt' into table tmp_jiangzl_test;
2.处理
select col1,col2,concat_ws(',',collect_set(col3))
from tmp_jiangzl_test
group by col1,col2;
0 0
- hive列转行 (collect_set())
- hive列转行 (collect_set())
- Hive中列转行函数collect_set详解
- Hive--行转列(Lateral View explode())和列转行(collect_set() 去重)
- Hive行转列,列转行
- Hive行转列,列转行
- Hive行转列、列转行
- hive列转行--行转列问题
- hive-列转行和行转列
- Hive "行转列"和"列转行"
- hive 行专列 列转行
- hive之实现列转行
- hive-列转行和行转列
- hive-行转列和列转行
- hive行专列,列转行
- Hive-行转列和列转行
- hive-列转行和行转列
- hive 行转列 列转行操作
- Bitmap too large to be uploaded into a texture (1080x4467, max=4096x4096)
- 计算python执行时间
- 例题1.10 正整数序列 UVa11384
- mysql 高性能索引策略
- 南邮NOJ卡片游戏
- hive列转行 (collect_set())
- BCB 使RichEdit自适应高度
- 史玉柱:我是怎么做游戏策划的
- PCH文件操作
- mongo c driver 在linux下编译使用
- 静态代理
- Java串口编程:串口数据的发送与监听读取
- 几种加载图片的方法对比
- 数据库第一章习题