Hive导入不同格式csv

separatorChar:分隔符
quoteChar:引号符

escapeChar:转意符

文件1:tbcsv1

创建表

hive> create table tbcsv1(id string,name string,age string)

. . > row format serde
. . > 'org.apache.hadoop.hive.serde2.OpenCSVSerde'
. . > with SERDEPROPERTIES
. . >  ("separatorChar"=",")
. . > STORED AS TEXTFILE;

导入数据

load data local inpath "e:/hive/tbcsv1.csv" into table tbcsv1;

显示数据

hive> select * from tbcsv1 ;

扫描二维码关注公众号,回复: 2229175 查看本文章


文件2:tbcsv2


创建表

hive> create table tbcsv2(id string,name string,age string)
. . > row format serde
. . > 'org.apache.hadoop.hive.serde2.OpenCSVSerde'
. . > with SERDEPROPERTIES
. . > ("separatorChar"="," ,"quotechar"="\"")

. . > STORED AS TEXTFILE;

导入数据

load data local inpath "e:/hive/tbcsv2.csv" into table tbcsv2;

显示数据

hive> select * from tbcsv2 ;




猜你喜欢

转载自blog.csdn.net/chy2z/article/details/80994077