词频统计
#创建表,只有一列,列名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;