我有这个csv文件:
"Nom_indicateur","Modalite","Val_Quant","Val_lignes","Val_pourcentage","Date_arretee","Code_boite","Metier","Env","NOM_CRE","Application","Type"
"NB_CB","","138","3630561","","201805","1EX4","PUB_1EPSE","PR","1EPSE","InterfacePublique","MAX"
"NB_CB","","0","3630561","","201805","1EX4","PUB_1EPSE","PR","1EPSE","InterfacePublique","MIN"
"NB_CB","","0.4613196142414354145268458510957397","3630561","","201805","1EX4","PUB_1EPSE","PR","1EPSE","InterfacePublique","MOY"
"CD_EFS","01","","1820824","50.15","201805","1EX4","PUB_1EPSE","PR","1EPSE","InterfacePublique","DIS"
"CD_EFS","02","","113674","3.13","201805","1EX4","PUB_1EPSE","PR","1EPSE","InterfacePublique","DIS"
"CD_EFS","03","","411607","11.34","201805","1EX4","PUB_1EPSE","PR","1EPSE","InterfacePublique","DIS"
"CD_EFS","13","","19342","0.53","201805","1EX4","PUB_1EPSE","PR","1EPSE","InterfacePublique","DIS"
"CD_EFS","21","","406668","11.2","201805","1EX4","PUB_1EPSE","PR","1EPSE","InterfacePublique","DIS"
"CD_EFS","29","","4609","0.13","201805","1EX4","PUB_1EPSE","PR","1EPSE","InterfacePublique","DIS"
"CD_EFS","56","","885","0.02","201805","1EX4","PUB_1EPSE","PR","1EPSE","InterfacePublique","DIS"
然后我创建配置单元表:
CREATE TABLE DATA_IND1 (Nom_indicateur string, Modalite string, Val_Quant double,Val_lignes int , Val_pourcentage double, Date_arretee string, Code_boite string, Metier string , Env string , NOM_CRE string,
> Application string, Type string)
> row format delimited fields terminated by ','
> STORED AS TEXTFILE;
然后我将csv文件插入此表:
LOAD DATA LOCAL INPATH '/home/Data_Indicateurs8.csv' OVERWRITE INTO TABLE DATA_IND1 ;
当我需要查看前10个元素时:
看看我能得到什么结果:
select * from DATA_IND1 limit 10;
"Nom_indicateur" "Modalite" NULL NULL NULL "Date_arretee" "Code_boite" "Metier" "Env" "NOM_CRE" "Application" "Type"
"NB_CB" "" NULL NULL NULL "201805" "1EX4" "PUB_1EPSE" "PR" "1EPSE" "InterfacePublique" "MAX"
"NB_CB" "" NULL NULL NULL "201805" "1EX4" "PUB_1EPSE" "PR" "1EPSE" "InterfacePublique" "MIN"
"NB_CB" "" NULL NULL NULL "201805" "1EX4" "PUB_1EPSE" "PR" "1EPSE" "InterfacePublique" "MOY"
"CD_EFS" "01" NULL NULL NULL "201805" "1EX4" "PUB_1EPSE" "PR" "1EPSE" "InterfacePublique" "DIS"
"CD_EFS" "02" NULL NULL NULL "201805" "1EX4" "PUB_1EPSE" "PR" "1EPSE" "InterfacePublique" "DIS"
"CD_EFS" "03" NULL NULL NULL "201805" "1EX4" "PUB_1EPSE" "PR" "1EPSE" "InterfacePublique" "DIS"
"CD_EFS" "13" NULL NULL NULL "201805" "1EX4" "PUB_1EPSE" "PR" "1EPSE" "InterfacePublique" "DIS"
"CD_EFS" "21" NULL NULL NULL "201805" "1EX4" "PUB_1EPSE" "PR" "1EPSE" "InterfacePublique" "DIS"
"CD_EFS" "29" NULL NULL NULL "201805" "1EX4" "PUB_1EPSE" "PR" "1EPSE" "InterfacePublique" "DIS"
Time taken: 0.382 seconds, Fetched: 10 row(s)
显示了许多Null值,它与输入的csv文件不同。
请问该如何解决?