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;
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;
© 版权声明
文章版权归作者所有,未经允许请勿转载。