I am trying to create a tab-separated value from a bush request.
Following the Apache Hive wiki, I wrote my query as:
INSERT OVERWRITE LOCAL DIRECTORY '/home/luca/query_results/'
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '\t' ESCAPED BY '"' LINES TERMINATED BY '\n'
STORED AS TEXTFILE
SELECT * FROM mytable ;
(note that the real request is quite complicated, I know that I could use it hive -e "Select * from mytable > outputin this simple case).
The query works, but in the query_results directory I find one file with the extension .snappy, and when I open it, it appears to be a binary file, not a text file.
What is wrong with my request? How can I get the results of my query in a well-formatted text file (I want to write a bush script that returns several such files. If I can even specify the file name from the hive, this will be a bonus).
source
share