ateral viem 表的关联只能和explode使用
hive> select explode(info) from t_map where id=1;
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;
//创建数据文件
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;
//求有几种类型
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;
//将炸裂的数据和 表关联 lateral view
hive> select id,name,type from mv lateral view explode(split(types,"\|")) t as type