Hive 实现 wordcount

Posted One-Way

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Hive 实现 wordcount相关的知识,希望对你有一定的参考价值。

 

创建表:

create table hive_wordcount(context string);
load data local inpath /home/hadoop/files/helloworld.txt into table hive_wordcount;

执行查询SQL:

select word, count(*) from hive_wordcount lateral view explode(split(context,\t)) wc as word group by word;

 

以上是关于Hive 实现 wordcount的主要内容,如果未能解决你的问题,请参考以下文章