Use optional LOCAL option to export data from Hive table into local CSV file. 1.2 Export Table into CSV File on LOCAL Directory This concatenates all files and put it back into HDFS at specified location. Hdfs dfs -cat /user/data/output/export/* | hadoop fs -put - /user/data/output/export/output.txt When you have data exported into multiple files, If you want a single file then you need to concatenate them on the client-side once the export is done. Hdfs dfs -cat /user/data/output/export/000000_0 Since our file is very small it exports into a single file and you can use the HDFS command to check the content of the exported file. Based on your table size, this command may export data into multiple files. This exports the complete Hive table into an export directory on HDFS. INSERT OVERWRITE DIRECTORY '/user/data/output/export' ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' SELECT * FROM emp.employee By default INSERT OVERWRITE DIRECTORY command exports result of the specified query into HDFS location.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |