hadoop - How to load CSV data with enclosed by double quotes and separated by tab into HIVE table? -
i trying load data csv file in values enclosed double quotes '"' , tab separated '\t' . when try load hive not throwing error , data loaded without error think data getting loaded single column , of values showing null. below create table statement.
create table example ( organization string, order bigint, created_on timestamp, issue_date timestamp, qty int ) row format delimited fields terminated '\t' escaped '"' stored textfile;
input file sample;-
"organization" "order" "created on" "issue_date" "qty" "gb" "111223" "2015/02/06 00:00:00" "2015/05/15 00:00:00" "5" "uk" "1110" "2015/05/06 00:00:00" "2015/06/1 00:00:00" "51"
and load statement push data hive table.
load data inpath '/user/example.csv' overwrite table example
what issue , how can ignore header of file. , if remove escaped '"' create statement loading in respective columns values enclosed double quotes. how can remove double quotes values , ignore header of file?
you can use opencsvserde allows define separator character , escape surrounding double-quotes :
create external table example ( organization string, order bigint, created_on timestamp, issue_date timestamp, qty int ) row format serde 'org.apache.hadoop.hive.serde2.opencsvserde' serdeproperties ( "separatorchar" = "\t", "quotechar" = "\"" ) location '/your/folder/location/';
Comments
Post a Comment