1.建内部表
hive> create table article(sentence string) row format delimited fields terminated by '\n';
OK
Time taken: 2.821 seconds
2.导入数据
hive (default)> load data local inpath './The_Man_of_Property.txt' overwrite into table article;
Loading data to table default.article
OK
Time taken: 1.244 seconds
3.实现
hive (default)> select word,count(*) from(
> select explode(split(sentence,' ')) as word from article) t
> group by word
> limit 10;