HIVE数据导入

来源:互联网 发布:冒险岛2激活码淘宝 编辑:程序博客网 时间:2024/06/03 11:12

1. text数据文件导出text数据表中

    数据格式:

    

     创建相应的数据表

     create table if not exists text_table(id int, count int) comment 'table desc' partitioned by (date int) row format delimited fields terminated by '\t' lines terminated by '\n' stored as textfile;

      导入数据
      load data local inpath '/tmp/xgs/data.text' into table text_table partition (date=20170727);


2. orc数据文件导入orc数据表中

    数据格式:

    

     创建相应的数据表

     create table if not exists orc_table(id int, count int) comment 'table desc' partitioned by (date int) row format delimited fields terminated by '\t' lines terminated by '\n' stored as orcfile;
    导入数据
    load data local inpath '/tmp/xgs/data.orc' into table orc_table partition (date=20170727);



3. orc与text互相导入

    主要是依靠insert关键字,如:insert into table orc_table partition (date=20170727) select id, count from text_table where date=20170727;

原创粉丝点击