首页 > 其他 > 详细

hive基本操作

时间:2017-02-03 14:45:34      阅读:246      评论:0      收藏:0      [点我收藏+]

hive>  create table textlines(line string);

hive> load data local inpath ‘/Users/lihu/Desktop/crawle/wahah.txt‘ into table textlines; 

hive> select * from textlines;

hive> create table words(word STRING);

hive> insert overwrite table words select explode(split(line, ‘ ‘)) word form textlines;

hive>  SELECT word,count(1) FROM words GROUP BY word ORDER BY word;

hive>  insert overwrite local directory ‘/Users/lihu/Desktop/crawle/wordcount_result‘ row format delimited fields terminated by ‘\t‘ SELECT word,count(1) FROM words GROUP BY word ORDER BY word;

 

 

hive> create table wyp  (id int, name string,  age int, tel string) ROW FORMAT DELIMITED  FIELDS TERMINATED BY ‘\t‘  STORED AS TEXTFILE;

hive> load data local inpath ‘/Users/lihu/Desktop/crawle/heihei.txt‘ into table wyp;

hive> insert overwrite local directory ‘/Users/lihu/Desktop/crawle/wyp‘ row format delimited fields terminated by ‘\t‘  select * from wyp;

 

 

hive> select author, sum(numberread),count(1) from taperr;

 

hive> create table tap  (title string, author string,  numberread int, url string) ROW FORMAT DELIMITED  FIELDS TERMINATED BY ‘  ‘  STORED AS TEXTFILE;

hive基本操作

原文:http://www.cnblogs.com/sunyaxue/p/6362570.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!