本文介绍了在Hadoop / PIG中压缩/解压gzip数据是否透明?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在某处读到Hadoop内置了对压缩和解压缩的支持,但我想这是关于mapper输出(通过设置一些属性)?
我想知道是否有任何特定的PIG加载/存储功能可用于读取压缩数据或以压缩格式输出数据?
解决方案PigStorage通过检查文件名来处理压缩输入:
- *。bz2 / * .bz - org.apache.pig.bzip2r.Bzip2TextInputFormat
- else使用 org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigTextInputFormat - 这扩展了 oahmapreduce.TextinputFormat 它可以处理.gz和zippy文件,如果你已经安装了编解码器
输出通过一些属性处理:
/ p> - outputpression.enabled - true / false $ b $ ( org.apache.hadoop.iopress.GzipCodec / code> for gzip)
- *.bz2 / *.bz - org.apache.pig.bzip2r.Bzip2TextInputFormat
- Everything else uses org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigTextInputFormat -- This extends o.a.h.mapreduce.TextinputFormat which can handle .gz and zippy files if you have the codecs installed
- outputpression.enabled - true / false
- outputpression.codec - the class name of the codec to use (org.apache.hadoop.iopress.GzipCodec for gzip)
如果您对此感兴趣,可以通过PigStorage.java进行挖掘对你的兴趣
I read somewhere that Hadoop has a built-in support for compression and decompression but I guess it is about mapper output (by setting some properties)?
I wonder if there is any particular PIG load/store functions I can use for reading compressed data or outputting data as compressed?
解决方案The PigStorage handles compressed input by examining the file names:
Output is handled via some properties:
If you're feeling up to it, digging through the PigStorage.java may be of interest to you
更多推荐
在Hadoop / PIG中压缩/解压gzip数据是否透明?
发布评论