怎样将文本文件导入impala中的分区表中
来源:互联网 发布:淘宝规蜜网址 编辑:程序博客网 时间:2024/06/02 04:36
1、在impala中建立无分区的表,例如gxzl_kgx_drw_NP
create table if not exists gxzl_kgx_drw_NP (mat_track_no string,materialcode string,id double,defectid double,mainno string,unitno string,side string,x double,y double,defectclass string,defectclasscode string,imagefile string,mat_act_width double,mat_act_len double,prod_end_time_zd string,reccreatetime string,equipmentcode string,num double,seq double,len_sum bigint,len_tot bigint,x_sum bigint,y_sum bigint,z_sum bigint,x_drw double,y_drw double,z_drw double) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t';
2、在impala中建立需要的有分区的表,例如gxzl_kgx_drw
create table if not exists gxzl_kgx_drw (materialcode string,id double,defectid double,mainno string,unitno string,side string,x double,y double,defectclass string,defectclasscode string,imagefile string,mat_act_width double,mat_act_len double,prod_end_time_zd string,reccreatetime string,equipmentcode string,num double,seq double,len_sum bigint,len_tot bigint,x_sum bigint,y_sum bigint,z_sum bigint,x_drw double,y_drw double,z_drw double) **partitioned by (mat_track_no string)** ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t';
3、将文本文件插入到无分区表中
load data inpath '/user/gxzl_kgx_drw.txt' into table gxzl_kgx_drw_NP;
注:impala的load只能使用hdfs文件路径,如果你的数据放在本地上,要先上传到hdfs中。
4、利用insert into…select向分区表中插入数据
insert into table gxzl_kgx_drw PARTITION(mat_track_no) select materialcode,id,defectid,mainno,unitno,side,x,y,defectclass,defectclasscode,imagefile,mat_act_width,mat_act_len,prod_end_time_zd,reccreatetime,equipmentcode,num,seq,len_sum,len_tot,x_sum,y_sum,z_sum,x_drw,y_drw,z_drw,**mat_track_no** from gxzl_kgx_drw_NP;
注:
对于动态分区,即未给PARTITION(mat_track_no)赋默认值,则定义的分区字段必须在 SELECT *所返回列的最后,这样就会自动按列表的最后字段做分区;
0 0
- 怎样将文本文件导入impala中的分区表中
- 将本地文本文件上传到HDFS上,然后导入hive/impala对应表中
- 将本地文本文件直接导入hive(impala好像不支持)表中
- 怎样将Excel中的数据导入到SQLServer2000数据库中
- 怎样将Excel中的数据导入到SQLServer2000数据库中
- 怎样将中的数据导入到2000中
- 怎样将DataGrid中的数据导入Excel中
- 怎样将excel中的数据导入到oracle数据库中
- 将文本文件导入oracle数据库中
- 将文本文件导入到Excel数据表中
- 利用php脚本将文本文件中的数据导入到mysql数据库中
- 将文本文件导入Sqlserver
- 将hbase中的表同步到hive和impala中
- 使用kettle将文本文件中的数据导入数据库
- 怎样将Excel中的数据导入到SQL Server 2000数据库中
- 怎样将Excel中的数据导入到SQL Server 2000数据库中
- 怎样将Excel中的数据导入到SQL Server 2000数据库中
- 怎样将excel中的数据通过PL/SQL导入ORACLE数据库中
- JSF maven environment set up
- Leetcode Palindrome Number C++
- 推荐个Mac OSX下的Code Editor:Atom
- React-Native入门指南
- escape() of javascript
- 怎样将文本文件导入impala中的分区表中
- Python基础教程(十一):多线程、XML解析
- \backend\models\core\Pdf
- Android 内部存储和外部存储
- socket TCP和UDP的区别对比http://www.cnblogs.com/zengqinglei/archive/2013/04/27/3046119.html
- 黑马程序员——初学java心得小总结
- Length of Last Word
- 流和文件描述符的关系
- $(document).Ready()方法 VS OnLoad事件 VS $(window).load()方法