1. Excel导出逗号文件.csv
2. 将CSV文件导入到hive服务器制定目录
3. 转换编码格式
转换编码格式,在指定目录下执行如下命令:piconv -f gb2312 -t UTF-8 CompanyCode.txt > c.txt
4. 在hive中建表
create table sf_staff_info(
uid string,
department string,
phone string
)
ROW format delimited
fields terminated by ‘,’
STORED AS TEXTFILE;
5. 加载数据到hive表中
load data local inpath ‘/home/rd/xiang/sf_staff_info.csv’ into table sf_staff_info;