Created 09-18-2017 11:31 AM
am having csv file data like this as shown below
example
1,"Air Transport International, LLC",example,city |
i have to load this data in hive like this as shown below
1,Air Transport InternationalLLC,example,city
but actually am getting like below??
1,Air Transport International, LLC,example,city
how to solve this problem
please give me solution
thanks with regards,
swathi.T
Created 09-18-2017 02:12 PM
@swathi thukkaraju,
You can use the below serde properties to read your data correctly
CREATE TABLE test(a string, b string,..) ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.OpenCSVSerde' WITH SERDEPROPERTIES ( "separatorChar" = ",", "quoteChar" = "\"" ) STORED AS TEXTFILE location 'location of csv file';
Created 09-18-2017 01:18 PM
You can use the CSV SerDe: https://cwiki.apache.org/confluence/display/Hive/CSV+Serde
This has support for quoted cells.
Please refer to the general SerDe documentation if you have questions on how to use SerDe's:
https://cwiki.apache.org/confluence/display/Hive/DeveloperGuide#DeveloperGuide-HiveSerDe
Created 09-18-2017 02:12 PM
@swathi thukkaraju,
You can use the below serde properties to read your data correctly
CREATE TABLE test(a string, b string,..) ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.OpenCSVSerde' WITH SERDEPROPERTIES ( "separatorChar" = ",", "quoteChar" = "\"" ) STORED AS TEXTFILE location 'location of csv file';
Created 01-08-2018 05:39 AM
Does it support load gzipped csv file? I got `FAILED: SemanticException Unable to load data to destination table. Error: The file that you are trying to load does not match the file format of the destination table.`