1、Hive实例操作
(1)创建本地movie.txt文件。
vim movie.txt
疑犯追踪 悬疑,动作,科幻,剧情Lie to me 悬疑,警匪,动作,心理,剧情
特种部队 战争,动作,灾难
(2)创建Hive表movie,
hive(hivedwh)>create table movie(
movie string,
category array<string>
)
row format delimited fields terminated
by "\t" collection items terminated
by ",";

(3)导入数据
load data local inpath "/opt/datas/movie.txt" into table movie;

(3)按需求查询数据
hive(hivedwh)>
select movie, category_name
from movie lateral view explode(category) subView
as category_name;
