Support Questions

Find answers, ask questions, and share your expertise

Issue Loading Data from HIVE Table into CSV File in HDFS

I am trying to run this query to load data from Hive Table to HDFS file. IT executes successfully but does not show any CSV file in the directory(sTestData) in hdfs. Any suggestions on what may be wrong with query or the access to the hdfs directory ?

INSERT OVERWRITE LOCAL DIRECTORY '/STestData/customershare.csv' ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' SELECT * FROM stestdata.customershare

1 ACCEPTED SOLUTION

The LOCAL keyword tells Hive to write the data to the local filesystem, not HDFS.

View solution in original post

4 REPLIES 4

The LOCAL keyword tells Hive to write the data to the local filesystem, not HDFS.

Thanks Michael. I removed local keyword and it works fine now. Is there a specific location in local where it creates this in subdirectory by default ?

You are welcome. Don't forget to accept the answer. 🙂

It should use the full pathname you specify after the DIRECTORY keyword. A common testing approach would be to use the tmp directory like '/tmp/my-output.cvv' and see if it is working as expected.

Insert Overwrite is creating a CSV file as directory name and with a file named 000000_0 with all the content. How can I make this to create CSV file with exact name that I give like customershare.csv from above query ?