Reply
Highlighted
Explorer
Posts: 14
Registered: ‎12-21-2016

How to handle delimiters, if they are part of the data, while exporting the data from the hive table

In hive,One of my column data contains Pipe as the part of the data('|'),however, while exporting data from this table,we need to export the data as the pipe('|') as the delimiter between each fields,How to handle if the delimiters as part of the data while creating the flat file from the hive table.

Posts: 177
Topics: 8
Kudos: 28
Solutions: 19
Registered: ‎07-16-2015

Re: How to handle delimiters, if they are part of the data, while exporting the data from the hive t

Like a proper CSV format you need to determined three specials characters :

* The field delimiter

* The end-of-line character

* The quote character (for protecting the delimiter and the end-of-line character)

 

For exemple :

* The field delimiter : ,

* The end-of-line character : "

* The quote character (for protecting the delimiter and the end-of-line character) : \n

 

This line :

 

toto,tata,"toto,tata"\n

Should be read as 3 fields (toto), (tata) and (toto,tata)

 

 

Announcements