CSV导入到hive中,处理分号问题

1、导入的原数据

103744;545479945;2017.05.17 06:41:08;sell;eurusd_;0.10;1.11080;1.11280;1.10880;1.11081;0.00;0.00;

2、建表语句。分号是hdfs中的特殊字符,需要把';'转成ascII码'\073'

create table hive_trade (heyue string,login string,type string,dangliang string,price1 string,sl string,tp string,price2 string,yongjin string,shuijin string) partitioned by (dt string)ROW FORMAT DELIMITED fields terminated by '\073' collection items terminated by '\073' STORED AS TEXTFILE;

3、加载数据到hive的分区表中。

load data local inpath '/home/importData/trade-import.csv' overwrite into table hive_trade partition(dt='2017-05-17');

posted @ 2017-12-26 07:49  莫为  阅读(1119)  评论(0编辑  收藏  举报