Hive 当某些值包含“csv”时,发出将csv加载到配置单元表的命令&引用;
我正在尝试将csv加载到配置单元表中,加载成功后,由于某些列值中的“,”而无法正确加载该表。解决这个问题的最佳方法是什么Hive 当某些值包含“csv”时,发出将csv加载到配置单元表的命令&引用;,hive,hdfs,Hive,Hdfs,我正在尝试将csv加载到配置单元表中,加载成功后,由于某些列值中的“,”而无法正确加载该表。解决这个问题的最佳方法是什么 create table abc (col1 string, col2 int) row format delimited fields terminated by ',' tblproperties("skip.header.line.count"="1"); CSV示例:- col1 col2 abc,def 12 erfd 10 load
create table abc (col1 string, col2 int) row format delimited fields terminated by ',' tblproperties("skip.header.line.count"="1");
CSV示例:-
col1 col2
abc,def 12
erfd 10
load data inpath 'path_to_csv' into table abc;
预期的输出是在配置单元中正确填充该表,就像在csv中一样。使用以下SERDE:
create table test_hive1(name String, id int)
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.OpenCSVSerde';
load data local inpath 'filepath' into table test_hive1;
select * from test_hive1;
name id
abc 22
cdf, def 23
dsa 34
使用OpenCSV serde
create table abc (col1 string, col2 int) row format
SERDE 'org.apache.hadoop.hive.serde2.OpenCSVSerde' WITH SERDEPROPERTIES
("escapeChar" = ",") ;
使用命令将数据加载到表中
load data local inpath 'path_to_csv' into table abc;
预期产量是多少?