hive学习01词频统计

词频统计
#创建表,只有一列,列名line
create table word_count (
line string)
row format delimited fields terminated by '\t'
lines terminated by '\n';
#导入一篇文章到表里
load data local inpath '/home/dip/test/word_count.txt'
#词频统计
select word ,count(*) as cnt
from
(select
explode(split(line ,' ')) as word
from word_count)t1
group by word
order by cnt desc;
上一篇:洛谷 P1450 解题报告


下一篇:HDU 5903 - Square Distance [ DP ] ( BestCoder Round #87 1002 )