关于Hive的常用HiveQL操作

发布时间 2023-10-17 22:59:12作者: 花伤错零

创建hive数据仓库:

create table docs(line string);

 

从hdfs上传文件到数据库:

load data inpath 'file:///usr/local/hadoop/input' overwrite into table docs;

根据词汇查询词汇数量:

create table word_count as 
select word, count(1) as count from
(select explode(split(line,' '))as word from docs) w
group by word
order by word;