Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
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.`