3

I am exporting a csv file into hive table. about the csv file : column values are enclosed within double-quotes , seperated by comma .

Sample record from csv

"4","good"
"3","not bad"
"1","very worst"

I created a hive table with the following statement,

create external table currys(review_rating string,review_comment string ) row format fields delimited by ',';

Table created .

now I loaded the data using the command load data local inpath and it was successful. when I query the table,

select * from currys;

The result is :

"4"  "good"
"3"  "not bad"
"1"   "very worst"

instead of

4  good
3  not bad
1  very worst

records are inserted with double-quotes which shouldnt be.

Please let me know how to get rid of this double quote .. any help or guidance is highly appreciated...

Thanks beforehand!

prasannads
  • 609
  • 2
  • 14
  • 28

1 Answers1

7

Are you using any serde? If so, then you can write a regex command in the SERDE PROPERTIES to remove the quotes.

Or you can use the csv-serde from here and define the quote character.

visakh
  • 2,503
  • 8
  • 29
  • 55