Hive中实现group concat功能(不用udf)
 
Sql代码  
hive> desc t;  
OK  
id      string  
str     string  
Time taken: 0.249 seconds  
hive> select * from t;  
OK  
1       A  
1       B  
2       C  
2       D  
Time taken: 0.209 seconds  
 
在Hive0.9中,可用:
 
SELECT id,
concat_ws('|', collect_set(str)) 
FROM t  
GROUP BY id;
得到结果:
 
1 A|B
2 C|D
 
但在hive0.7中不容易实现,concat_ws函数不支持Array。

相关文章:

  • 2021-12-07
  • 2021-11-14
  • 2022-12-23
  • 2021-11-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-08
  • 2021-09-02
  • 2021-05-16
  • 2022-12-23
  • 2022-01-03
  • 2021-07-16
  • 2021-07-21
相关资源
相似解决方案