Skip to main content
lalala
Silver ⭐️⭐️
Aug 12, 2021 12:39 PM UTC
Question

Remove double quotation in impala output

I have a csv data which I have to load in impala/hive. does anyone knows how to remove the double quotation mark in the output? Here is my sample create table scripts.

 

CREATE EXTERNAL TABLE schema.table (   id int,   name STRING,   desc STRING,   desc1 STRING ) ROW FORMAT DELIMITED FIELDS TERMINATED BY '|' WITH SERDEPROPERTIES ('field.delim'='|', 'serialization.format'='|') STORED AS TEXTFILE LOCATION '/user/folder/schema/table'

6 replies

ChethanYM
Gold ⭐️
Gold ⭐️
Aug 13, 2021 12:21 AM UTC

Hi,

 

Can you provide the sample output for the same where you are seeing the double quotation mark?

 

Regards,

Chethan YM

Translate
lalala
lalalaAuthor
Silver ⭐️⭐️
Aug 13, 2021 12:45 AM UTC

Hello,

 

This is the sample output:

 

Screenshot 2021-08-13 084332.png

Translate
ChethanYM
Gold ⭐️
Gold ⭐️
Aug 13, 2021 12:57 AM UTC

Hi @lalala ,

 

This behavior was caused by the csv module when impala is using it to export the data.

 

    # csv.writer expects a file handle to the input.

    # cStringIO is used as the temporary buffer.

    temp_buffer = StringIO()

    writer = csv.writer(temp_buffer, delimiter=self.field_delim,

                        lineterminator='\n', quoting=csv.QUOTE_MINIMAL)

    writer.writerows(rows)

 

Seems to be we cannot change this since it is needs to modified at code level.

 

[1]. 

https://github.com/apache/impala/blob/014c455aaaa38010ae706228f7b439c080c0bc7d/shell/shell_output.py#L64

Translate