ITPub博客

首页 > Linux操作系统 > Linux操作系统 > hive建表

hive建表

原创 Linux操作系统 作者:YallonKing 时间:2012-03-31 18:08:43 0 删除 编辑
hdoop+hive安装见我的博文:
http://space.itpub.net/?uid-26143577-action-viewspace-itemid-720091
----创建行存储测试表
hive> create table test_hive2 (id int,id2 int,name string)
    > row format delimited
    > fields terminated by '\t';
OK
Time taken: 0.055 seconds
hive> load data local inpath '/root/tmp001.txt'
    > overwrite into table test_hive2;
Copying data from file:/root/tmp001.txt
Copying file: file:/root/tmp001.txt
Loading data to table default.test_hive2
Deleted file:/user/hive/warehouse/test_hive2
OK
Time taken: 0.342 seconds
----创建列存储测试表
hive> create table test_hive (id int,id2 int,name string)
    > row format serde 'org.apache.hadoop.hive.serde2.columnar.ColumnarSerDe'
    > STORED AS RCFILE;
OK
Time taken: 2.944 seconds
--插入数据
hive> insert overwrite table test_hive
    > select id,id2,name               
    > from test_hive2;
Total MapReduce jobs = 2
Launching Job 1 out of 2
Number of reduce tasks is set to 0 since there's no reduce operator
Execution log at: /tmp/root/root_20120331164444_44ac1bdb-f603-45e2-b50a-4681e69d330f.log
Job running in-process (local Hadoop)
2012-03-31 16:44:31,709 null map = 100%,  reduce = 0%
Ended Job = job_local_0001
Ended Job = 171641075, job is filtered out (removed at runtime).
Moving data to: file:/tmp/hive-root/hive_2012-03-31_16-44-28_048_8584030323247636747/-ext-10000
Loading data to table default.test_hive
Deleted file:/user/hive/warehouse/test_hive
Table default.test_hive stats: [num_partitions: 0, num_files: 1, num_rows: 65535, total_size: 961048]
OK
Time taken: 3.946 seconds
 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26143577/viewspace-720092/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2011-08-07

  • 博文量
    72
  • 访问量
    248662