Changes between Version 4 and Version 5 of waue/2009/0506
- Timestamp:
- May 6, 2009, 5:01:26 PM (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
waue/2009/0506
v4 v5 13 13 = 安裝 = 14 14 15 15 在 hadoop 0.19.1 的 contrib 內已有 hive 的專案,先匯入環境變數後在進到此資料夾執行hive就可以使用了 16 {{{ 17 $ export HADOOP=/opt/hadoop/ 18 $ export HIVE_HOME=/opt/hadoop/contrib/hive/ 19 $ cd /opt/hadoop/contrib/hive 20 $ bin/hive 21 hive> 22 }}} 16 23 17 24 = 測試 = 18 {{{ 19 [hadoop@gp1 bin]$ export HADOOP=/home/hadoop/hadoop-0.19.1 20 [hadoop@gp1 bin]$ export HIVE_HOME=/home/hadoop/hadoop-0.19.1/contrib/hive/ 21 22 [hadoop@gp1 bin]$ cd $HIVE_HOME 23 [hadoop@gp1 hive]$ bin/hive 24 25 26 27 {{{ 25 28 hive> CREATE TABLE pokes (foo INT, bar STRING); 29 }}} 30 * 31 {{{ 26 32 OK 27 33 Time taken: 0.251 seconds 34 }}} 35 36 {{{ 28 37 hive> CREATE TABLE invites (foo INT, bar STRING) PARTITIONED BY (ds STRING); 38 }}} 39 * 40 {{{ 29 41 OK 30 42 Time taken: 0.106 seconds 43 }}} 44 45 {{{ 31 46 hive> SHOW TABLES; 47 }}} 48 * 49 {{{ 32 50 OK 33 51 invites pokes 34 52 Time taken: 0.107 seconds 53 }}} 54 55 {{{ 35 56 hive> DESCRIBE invites; 57 }}} 58 * 59 {{{ 36 60 OK 37 61 foo int … … 39 63 ds string 40 64 Time taken: 0.151 seconds 65 }}} 66 67 {{{ 41 68 hive> ALTER TABLE pokes ADD COLUMNS (new_col INT); 69 }}} 70 * 71 {{{ 42 72 OK 43 73 Time taken: 0.117 seconds 44 hive> ALTER TABLE invites ADD COLUMNS (new_col2 INT COMMENT 『a comment'); 74 }}} 75 76 {{{ 77 hive> ALTER TABLE invites ADD COLUMNS (new_col2 INT COMMENT 'a comment'); 78 }}} 79 * 80 {{{ 45 81 OK 46 82 Time taken: 0.152 seconds 47 hive> LOAD DATA LOCAL INPATH 『./examples/files/kv1.txt' OVERWRITE INTO TABLE pokes; 83 }}} 84 85 {{{ 86 hive> LOAD DATA LOCAL INPATH './examples/files/kv1.txt' 87 OVERWRITE INTO TABLE pokes; 88 }}} 89 * 90 {{{ 48 91 Copying data from file:/home/hadoop/hadoop-0.19.1/contrib/hive/examples/files/kv1.txt 49 92 Loading data to table pokes 50 93 OK 51 94 Time taken: 0.288 seconds 52 hive> LOAD DATA LOCAL INPATH 『./examples/files/kv2.txt' OVERWRITE INTO TABLE invites PARTITION (ds=』2008-08-15′); 95 }}} 96 97 {{{ 98 hive> LOAD DATA LOCAL INPATH './examples/files/kv2.txt' 99 OVERWRITE INTO TABLE invites PARTITION (ds='2008-08-15'); 100 }}} 101 * 102 {{{ 53 103 Copying data from file:/home/hadoop/hadoop-0.19.1/contrib/hive/examples/files/kv2.txt 54 104 Loading data to table invites partition {ds=2008-08-15} 55 105 OK 56 106 Time taken: 0.524 seconds 57 hive> LOAD DATA LOCAL INPATH 『./examples/files/kv3.txt' OVERWRITE INTO TABLE invites PARTITION (ds=』2008-08-08′); 107 }}} 108 109 {{{ 110 hive> LOAD DATA LOCAL INPATH './examples/files/kv3.txt' 111 OVERWRITE INTO TABLE invites PARTITION (ds='2008-08-08'); 112 }}} 113 * 114 {{{ 58 115 Copying data from file:/home/hadoop/hadoop-0.19.1/contrib/hive/examples/files/kv3.txt 59 116 Loading data to table invites partition {ds=2008-08-08} 60 117 OK 61 118 Time taken: 0.406 seconds 62 63 hive> INSERT OVERWRITE DIRECTORY 『/tmp/hdfs_out' SELECT a.* FROM invites a; 119 }}} 120 121 {{{ 122 hive> INSERT OVERWRITE DIRECTORY '/tmp/hdfs_out' 123 SELECT a.* FROM invites a; 124 }}} 125 * 126 {{{ 64 127 Total MapReduce jobs = 1 65 128 Starting Job = job_200902261245_0002, Tracking URL = http://gp1:50030/jobdetails.jsp?jobid=job_200902261245_0002 … … 72 135 OK 73 136 Time taken: 18.551 seconds 74 137 }}} 138 139 {{{ 75 140 hive> select count(1) from pokes; 141 }}} 142 * 143 {{{ 76 144 Total MapReduce jobs = 2 77 145 Number of reducers = 1 … … 96 164 500 97 165 Time taken: 57.285 seconds 98 99 hive> INSERT OVERWRITE DIRECTORY 『/tmp/hdfs_out' SELECT a.* FROM invites a; 166 }}} 167 168 {{{ 169 hive> INSERT OVERWRITE DIRECTORY '/tmp/hdfs_out' SELECT a.* FROM invites a; 170 }}} 171 * 172 {{{ 100 173 Total MapReduce jobs = 1 101 174 Starting Job = job_200902261245_0005, Tracking URL = http://gp1:50030/jobdetails.jsp?jobid=job_200902261245_0005 … … 108 181 OK 109 182 Time taken: 18.349 seconds 110 111 hive> INSERT OVERWRITE DIRECTORY 『/tmp/reg_5′ SELECT COUNT(1) FROM invites a; 183 }}} 184 185 {{{ 186 hive> INSERT OVERWRITE DIRECTORY '/tmp/reg_5' SELECT COUNT(1) FROM invites a; 187 }}} 188 * 189 {{{ 112 190 Total MapReduce jobs = 2 113 191 Number of reducers = 1