Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

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

Highlighted

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

Rising Star

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.

1 REPLY 1

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

Super Collaborator

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)

 

 

Don't have an account?
Coming from Hortonworks? Activate your account here