Skip to content

Instantly share code, notes, and snippets.

@sankars
Created May 20, 2014 06:49
Show Gist options
  • Save sankars/210ab04a030cfbcbd9f7 to your computer and use it in GitHub Desktop.
Save sankars/210ab04a030cfbcbd9f7 to your computer and use it in GitHub Desktop.
Hive Commands that uses HDFS for storage
-- http://stackoverflow.com/questions/18129581/how-do-i-output-the-results-of-a-hiveql-query-to-csv
INSERT OVERWRITE LOCAL DIRECTORY '/target/directory/' select books from table; -- writes to local file system
INSERT OVERWRITE DIRECTORY '/target/directory/' select books from table; -- writes to HDFS. column seperator -> ^A row -> /n
hive -e 'select books from table' > /target/directory/file.tsv -- to local file system
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment