Archive

January 2012

Hadoop Snappy compression example with Hive

Snappy is a fast compression codec widely used in Hadoop ecosystems. This updated guide shows how to generate data, upload it to HDFS, process it with Hive using Snappy compression, verify the output files, and load Snappy-compressed data back into Hive using modern Hadoop commands. To use Snappy compression in Hadoop with Hive, turn on compressed output and set the codec to SnappyCodec before you write the table: SET hive.exec.compress.output=true; SET mapreduce.output.fileoutputformat.compress.codec=org.apache.hadoop.io.compress.SnappyCodec; SET mapreduce.output.fileoutputformat.compress.type=BLOCK; The rest of this post is a full working example. It creates test data, puts it into HDFS, writes a Snappy compressed Hive table, checks the .snappy file and loads it back into Hive. Snappy is a compression library from Google. It is built for speed rather than the smallest files, which is why it is a common choice in Hadoop and Hive pipelines. It works with Hadoop 2.x and 3.x...