文件m:
a:shandong,b:beijing,c:hebei|1,2,3,4,5,6,7,8,9|
[{"source":"7fresh","monthSales":4900,"userCount":1900,"score":"9.9"},
{"source":"jd","monthSales":2090,"userCount":78981,"score":"9.8"},
{"source":"jdmart","monthSales":6987,"userCount":1600,"score":"9.0"}]
drop table if exists elv;
create table if not exists elv(
`area` string ,
`goods_id` string ,
`sale_info` string
)
row format delimited fields terminated by '|'
stored as textfile;
load data local inpath '/usr/m' into table elv;
select * from elv;
select goods_id2,sale_info
from elv
LATERAL VIEW explode( split(goods_id,',') )goods as goods_id2;
select goods_id2,sale_info,area2
from elv
LATERAL VIEW explode(split(goods_id,','))goods as goods_id2
LATERAL VIEW explode(spli
hive LATERAL VIEW explode和get_json_object
最新推荐文章于 2022-04-18 17:43:43 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)