Home‎ > ‎

How to output a table or result of a query to a local file or HDFS in Hive

The following command outputs the table to local directory
INSERT OVERWRITE LOCAL DIRECTORY '<directory>' SELECT * FROM table_name;
 The following command outputs the table to a HDFS file
INSERT OVERWRITE DIRECTORY '/tmp/hdfs_out' SELECT a.* FROM table_name;
Comments