Hive导入csv文件示例(hive导入excel数据)满满干货

随心笔谈12个月前发布 admin
171 0

drop table csv2;
create table if not exists csv2
(
uid int,
uname string,
age int
)
row format serde ‘org.apache.hadoop.hive.serde2.OpenCSVSerde’
stored as textfile;
— 先导入csv文件到表格csv2,保存格式是textfile
load data local inpath ‘/data/csv2.csv’ into table csv2;

drop table csv3;
— 创建csv3,保存格式parquet
create table if not exists csv3
(
uid int,
uname string,
age int
)
row format delimited
fields terminated by ‘,’
stored as parquet;
— 提取csv2的数据插入到csv3
insert overwrite table csv3 select * from csv2;

© 版权声明

相关文章