hvie炸裂函数explode

ateral viem 表的关联只能和explode使用

hive> select explode(info) from t_map where id=1;

hvie炸裂函数explode

hvie炸裂函数explode

hive> create table watch(id int,name string) row format delimited fields terminated by " ";

vim movie.txt
CN_lldd
CN_sjd
CN_jp
CN_rpt
USA_yns
USA_sd
USA_ydfdf
USA_gdffd


load data local inpath "/movie.txt" into table watch;

 hvie炸裂函数explode

 

//创建数据文件
lldq js|kh|dz|yq
sdyjq dz|js|js
yw ll|yq|dz
//上传数据
load data local inpath "/mv.txt" into table mv;
//将数据炸开
hive> select explode(split(types,"\\|")) from mv;

hvie炸裂函数explode

 

//求有几种类型
hive> select count(*) from (select explode(split(types,"\\|"))type from mv) t group by t.type;
hive> select count(*),type from (select explode(split(types,"\\|"))type from mv) t group by t.type;

hvie炸裂函数explode

 

//将炸裂的数据和 表关联 lateral view
hive> select id,name,type from mv lateral view explode(split(types,"\\|")) t as type

hvie炸裂函数explode

 

相关文章:

  • 2022-12-23
  • 2021-09-09
  • 2022-12-23
  • 2022-12-23
  • 2021-04-24
  • 2021-06-03
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-27
  • 2021-07-17
  • 2022-12-23
相关资源
相似解决方案