Samuel Kerrien
Samuel Kerrien

Reputation: 7085

How to export hive query with a custom field separator

I have a table in hive 0.9 where the fields are \001 separated. I have some of my fields containing tabulations. As a result when I query my data using Hive on the command line:

hive -e "SELECT * FROM my_table" > output.tsv

I get extra columns in my output file. In essence, I would like to be able to do something like

hive --output-field-separator '\001' -e "SELECT * FROM my_table"

Does anyone know a workaround ?

Upvotes: 3

Views: 8109

Answers (1)

Lukas Vermeer
Lukas Vermeer

Reputation: 5940

You could try using INSERT OVERWRITE instead to write your data to a file. In Hive 0.9 you cannot change the separator using this method, but it looks like that will be possible in a future release.

More details in this answer.

Hope that helps.

Upvotes: 1

Related Questions