Tuesday, November 16, 2010

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 '' 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;

No comments:

Post a Comment