1. 程式人生 > >Hive 實現 wordcount

Hive 實現 wordcount

style nbsp logs 執行 txt hive ble text bsp

創建表:

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