读书人

hadoop1.0.1上hive0.8.1 的安装及其运

发布时间: 2012-12-26 14:39:29 作者: rapoo

hadoop1.0.1下hive0.8.1 的安装及其运行示例(升级版)

在一个版本中没有进行分区和数据插入的相关操作。

1.创建另一张表:

CREATE TABLE IF NOT EXISTS ?people_test2

? ? (

? ? name ? ?STRING,?

? ? age INT,

? ? address STRING

? ? )

? ? PARTITIONED BY (datestr STRING)

? ? ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'

? ? STORED AS TEXTFILE

? ? LOCATION '/user/ganliang/hive_data/people_test2';//这个路径后来改了,因为会覆盖掉/user/ganliang/hive_data

?

2.

INSERT OVERWRITE TABLE people_test2 PARTITION(datestr='20121125')

select * from people_test where address like '湖北%';

?

INSERT OVERWRITE TABLE people_test2 PARTITION(datestr='20121126')

select * from people_test where address ?not like '湖北%';

?

3.试试看

hive> select * from people_test2 where datestr=20121125 and name='ganliang';

Total MapReduce jobs = 1

Launching Job 1 out of 1

Number of reduce tasks is set to 0 since there's no reduce operator

Starting Job = job_201211251920_0005, Tracking URL = http://localhost:50030/jobdetails.jsp?jobid=job_201211251920_0005

Kill Command = /home/hadoop/libexec/../bin/hadoop job ?-Dmapred.job.tracker=localhost:9001 -kill job_201211251920_0005

Hadoop job information for Stage-1: number of mappers: 1; number of reducers: 0

2012-11-25 20:59:20,828 Stage-1 map = 0%, ?reduce = 0%

2012-11-25 20:59:26,862 Stage-1 map = 100%, ?reduce = 0%, Cumulative CPU 1.58 sec

2012-11-25 20:59:27,867 Stage-1 map = 100%, ?reduce = 0%, Cumulative CPU 1.58 sec

2012-11-25 20:59:28,875 Stage-1 map = 100%, ?reduce = 0%, Cumulative CPU 1.58 sec

2012-11-25 20:59:29,884 Stage-1 map = 100%, ?reduce = 0%, Cumulative CPU 1.58 sec

2012-11-25 20:59:30,897 Stage-1 map = 100%, ?reduce = 0%, Cumulative CPU 1.58 sec

2012-11-25 20:59:31,906 Stage-1 map = 100%, ?reduce = 0%, Cumulative CPU 1.58 sec

2012-11-25 20:59:32,916 Stage-1 map = 100%, ?reduce = 100%, Cumulative CPU 1.58 sec

MapReduce Total cumulative CPU time: 1 seconds 580 msec

Ended Job = job_201211251920_0005

MapReduce Jobs Launched:?

Job 0: Map: 1 ? Accumulative CPU: 1.58 sec ? HDFS Read: 287 HDFS Write: 34 SUCESS

Total MapReduce CPU Time Spent: 1 seconds 580 msec

OK

ganliang25湖北咸宁20121125

Time taken: 19.696 seconds

hive>?


读书人网 >编程

热点推荐