@Arslan6and6
2016-09-03T13:26:16.000000Z
字数 825
阅读 1003
第七章、大数据仓库Hive深入
[beifeng@hadoop-senior hadoop-2.5.0-cdh5.3.6]$ more sort.txthadoop javamapreduce mapreduce mapyarn historyhadoop yarnyarn java[beifeng@hadoop-senior hadoop-2.5.0-cdh5.3.6]$ pwd/opt/modules/hadoop-2.5.0-cdh5.3.6hive (test)> create table sort (fieldname string);load data local inpath '/opt/modules/hadoop-2.5.0-cdh5.3.6/sort.txt' into table sort;hive (test)> select * from sort;OKsort.fieldnamehadoop javamapreduce mapreduce mapyarn historyhadoop yarnyarn javahive (test)> create table words (word string);//将按行分割后的数据加载入 表wordshive (test)> insert overwrite table words select explode(split(fieldname,'[\t]')) word from sort;hive (test)> select * from words;OKwords.wordhadoopjavamapreducemapreducemapyarnhistoryhadoopyarnyarnjavahive (test)> select word,count(word) count from words group by word;word counthadoop 2history 1java 1java 1map 2mapreduce 1reduce 1yarn 3
