You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by Craig Macdonald <cr...@dcs.gla.ac.uk> on 2007/12/20 15:17:14 UTC

Compressed data file questions

I have some compression related questions

Utkarsh Srivastava wrote:
 >Also, you do not need to run on uncompressed data. You can run Pig 
directly on bz2 files.

Actually, I just compressed it for transfer over the net, but this 
reminds me of questions I have.

I have large compressed datasets on which I want to run Pig on.
Eg one file (gzip compressed 9GB), 100 GB uncompressed.

If I put this into Pig, does it compress each block separately (say 
option [a]), or does it just chunk the compressed file (which isnt 
handy) (option [b]). If Pig can handle the compressed files [and the 
latter is true], I assume that it has to stream the entire file to one 
map task - which defeats the purpose really.

Hadoop has options called
mapred.output.compression.type and mapred.map.output.compression.type
Does these affect the question above?
They are by default set to RECORD, I presume BLOCK enables option [a] - 
to some respect, but they both seem to affect the output of mapred, not 
the input?

For the files above, it's not really handy to decompress each file, then 
load it into dfs.

Thanks

Craig

Re: Compressed data file questions

Posted by Benjamin Reed <br...@yahoo-inc.com>.
Right now only bz2 files are supported. I have an open issue and the start of 
a patch for gzip support, but it's not there yet.

When Pig runs against a bz2 file and (in the future) a properly formatted 
gzip2 file, it chuncks up the file and then finds compression resync points 
to properly segment the compressed chunks of the file.

We have not tested with the record and block compression built into Hadoop. It 
should work; we just haven't tried it.

ben

On Thursday 20 December 2007 06:17:14 Craig Macdonald wrote:
> I have some compression related questions
>
> Utkarsh Srivastava wrote:
>  >Also, you do not need to run on uncompressed data. You can run Pig
>
> directly on bz2 files.
>
> Actually, I just compressed it for transfer over the net, but this
> reminds me of questions I have.
>
> I have large compressed datasets on which I want to run Pig on.
> Eg one file (gzip compressed 9GB), 100 GB uncompressed.
>
> If I put this into Pig, does it compress each block separately (say
> option [a]), or does it just chunk the compressed file (which isnt
> handy) (option [b]). If Pig can handle the compressed files [and the
> latter is true], I assume that it has to stream the entire file to one
> map task - which defeats the purpose really.
>
> Hadoop has options called
> mapred.output.compression.type and mapred.map.output.compression.type
> Does these affect the question above?
> They are by default set to RECORD, I presume BLOCK enables option [a] -
> to some respect, but they both seem to affect the output of mapred, not
> the input?
>
> For the files above, it's not really handy to decompress each file, then
> load it into dfs.
>
> Thanks
>
> Craig



Re: Compressed data file questions

Posted by Ted Dunning <td...@veoh.com>.
You are a champ!

Can somebody else comment authoritatively about the preferred method for
getting a vanilla Hadoop program to produce bz2 compressed output?

For instance, suppose that I have the following snippet:

    conf.setInputFormat(TextInputFormat.class);
    conf.setOutputFormat(TextOutputFormat.class);

What would I have to add to indicate that my input was bz2 compressed?
Would hadoop figure it out automagically?

Similarly, what would I have to say to tell hadoop to bz2 compress my
output?


On 12/20/07 11:56 AM, "Utkarsh Srivastava" <ut...@yahoo-inc.com> wrote:

> I added some documentation on this:
> 
> http://wiki.apache.org/pig/
> PigLatin#head-8e419219563705f0cbe965015fa85c2b6e59b168


Re: Compressed data file questions

Posted by Utkarsh Srivastava <ut...@yahoo-inc.com>.
I added some documentation on this:

http://wiki.apache.org/pig/ 
PigLatin#head-8e419219563705f0cbe965015fa85c2b6e59b168

Utkarsh

On Dec 20, 2007, at 6:17 AM, Craig Macdonald wrote:

> I have some compression related questions
>
> Utkarsh Srivastava wrote:
> >Also, you do not need to run on uncompressed data. You can run Pig  
> directly on bz2 files.
>
> Actually, I just compressed it for transfer over the net, but this  
> reminds me of questions I have.
>
> I have large compressed datasets on which I want to run Pig on.
> Eg one file (gzip compressed 9GB), 100 GB uncompressed.
>
> If I put this into Pig, does it compress each block separately (say  
> option [a]), or does it just chunk the compressed file (which isnt  
> handy) (option [b]). If Pig can handle the compressed files [and  
> the latter is true], I assume that it has to stream the entire file  
> to one map task - which defeats the purpose really.
>
> Hadoop has options called
> mapred.output.compression.type and mapred.map.output.compression.type
> Does these affect the question above?
> They are by default set to RECORD, I presume BLOCK enables option  
> [a] - to some respect, but they both seem to affect the output of  
> mapred, not the input?
>
> For the files above, it's not really handy to decompress each file,  
> then load it into dfs.
>
> Thanks
>
> Craig