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码'73'

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 '73' collection items terminated by '73' STORED AS TEXTFILE;

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

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

原文地址:https://www.cnblogs.com/mowei/p/8116230.html