CDH5.4.5运行多字符分割记录
2015-09-05 00:12
507 查看
准备工作:
测试文件内容:cis_cust_imp_info
20131131|+|100010001001|+|BR01|+|2000.01
20131131|+|100010001002|+|BR01|+|2000.02
20131131|+|100010001003|+|BR02|+|2000.03
将测试文件放入HDFS:
sudo -u hdfs hdfs dfs -mkdir -p /ceb/cis_cust_imp_info
sudo -u hdfs hdfs dfs -chmod 777 /ceb/cis_cust_imp_info
hdfs dfs -put cis_cust_imp_info /ceb/cis_cust_imp_info
在Hive中输入下面的命令:
add jar /opt/cloudera/parcels/CDH/lib/hive/lib/hive-contrib-1.1.0-cdh5.4.5.jar;
add jar /root/ceb/HiveMultiDelimiter.jar;
DROP TABLE IF EXISTS cis_cust_imp_info_ext;
CREATE EXTERNAL TABLE IF NOT EXISTS cis_cust_imp_info_ext(statistics_dt string,cust_id string,open_org_id string,assert9_bal string)
ROW FORMAT SERDE 'com.cloudera.hadoop.hive.contrib.serde2.alter.MultiDelimitSerDe' WITH SERDEPROPERTIES ('input.delimited'='\|\+\|','field.encoding'='utf-8')
LOCATION '/ceb/cis_cust_imp_info';
select * from cis_cust_imp_info_ext;
--hive:将多字符分割变成impala/phoenix能处理的txt
create table cis_cust_imp_info(cust_id string,statistics_dt string,assert9_bal double)
ROW FORMAT DELIMITED FIELDS TERMINATED BY ',';
insert overwrite table cis_cust_imp_info select cust_id, statistics_dt, assert9_bal from cis_cust_imp_info_ext;
测试文件内容:cis_cust_imp_info
20131131|+|100010001001|+|BR01|+|2000.01
20131131|+|100010001002|+|BR01|+|2000.02
20131131|+|100010001003|+|BR02|+|2000.03
将测试文件放入HDFS:
sudo -u hdfs hdfs dfs -mkdir -p /ceb/cis_cust_imp_info
sudo -u hdfs hdfs dfs -chmod 777 /ceb/cis_cust_imp_info
hdfs dfs -put cis_cust_imp_info /ceb/cis_cust_imp_info
在Hive中输入下面的命令:
add jar /opt/cloudera/parcels/CDH/lib/hive/lib/hive-contrib-1.1.0-cdh5.4.5.jar;
add jar /root/ceb/HiveMultiDelimiter.jar;
DROP TABLE IF EXISTS cis_cust_imp_info_ext;
CREATE EXTERNAL TABLE IF NOT EXISTS cis_cust_imp_info_ext(statistics_dt string,cust_id string,open_org_id string,assert9_bal string)
ROW FORMAT SERDE 'com.cloudera.hadoop.hive.contrib.serde2.alter.MultiDelimitSerDe' WITH SERDEPROPERTIES ('input.delimited'='\|\+\|','field.encoding'='utf-8')
LOCATION '/ceb/cis_cust_imp_info';
select * from cis_cust_imp_info_ext;
--hive:将多字符分割变成impala/phoenix能处理的txt
create table cis_cust_imp_info(cust_id string,statistics_dt string,assert9_bal double)
ROW FORMAT DELIMITED FIELDS TERMINATED BY ',';
insert overwrite table cis_cust_imp_info select cust_id, statistics_dt, assert9_bal from cis_cust_imp_info_ext;
相关文章推荐
- 让IE浏览器支持HTML5
- CDH5.4.5运行Phoenix导入CSV文件
- HTML5 Canvas绘图API
- HTML5 文件操作
- html5 use video camera
- H5火了 “吴亦凡即将入伍?!”创作团队讲述创意完整过程
- HTML5本地存储:SessionStorage, LocalStorage, Cookie
- HTML5 标签
- html5中的一些小知识点(CSS)
- HTML5与CSS3权威指南 - 笔记
- HTML5画出iphone6,你敢画ipad吗
- 【h5-egret】深入浅出对象池
- HTML5页面增强元素
- 【实例】html5-canvas中实现背景图片的移动
- 22个HTML5的初级技巧
- h5 audio 和 video
- HTML5----Canvas 学习笔记一
- [持续更新]HTML5学习笔记(四)
- HTML5之WebSocket(仅介绍客户端的实现)
- HTML5离线存储