Hive achieve WordCount count
Before did not learn Hive, we learn to realize when MaprReduce WordCount count, it is necessary to write code for more than 80 java line, and now we learn the Hive, we only need one line Sql statement can be achieved.
Prepare data
Create a table in the hive
Using the import command to import the local data
select check
Each row of data is divided
select split(line,',') from wc;
Rows into columns
select explode(split(line,',')) from wc;
The same group statistics
select w.word,count(*) from (select explode(split(line,',')) as word from wc) w group by w.word;