[ 
http://issues.apache.org/jira/browse/HADOOP-54?page=comments#action_12422002 ] 
            
Owen O'Malley commented on HADOOP-54:
-------------------------------------

Ok, I talked with Eric about this.

The thought about BytesWritable was just about trying to get rid of the 
redundant lengths in the SequenceFile format. (Both the Writable object and the 
SequenceFile encode the object's length.) This redundancy is caused because 
Writable.readFields is not given the length and yet the SequenceFile wants to 
be able to know the length so that it can copy/skip keys and values during copy 
and sorting. Unfortunately, to remove the redundancy would require extending 
the Writable interface, which would break a lot of application code. (We could 
make an optional extension that provides a mechanism for getting the length out 
of the serialized form or copying the raw bytes of the proper length and allow 
Writable types to implement the sub-interface if they want to have smaller 
files.)

For now, I'd suggest mixing in the length in a zero compressed format. 

So inside the compressed key block would look like:
<key1-length><key1-bytes><key2-length><key2-bytes><key3-length><key3-bytes>

And the inside of the compressed value block would look like:
<value1-length><value1-bytes><value2-length><value2-bytes><value3-length><value3-bytes>

The blocks would look like:
<sync><num-records><compressed-key-bytes><compressed-value-bytes><compressed-keys-data><compressed-values-data>

With the blocks padding upto io.sequencefile.pad.percent to align to the DFS 
block boundary.

Does that sound reasonable?

> SequenceFile should compress blocks, not individual entries
> -----------------------------------------------------------
>
>                 Key: HADOOP-54
>                 URL: http://issues.apache.org/jira/browse/HADOOP-54
>             Project: Hadoop
>          Issue Type: Improvement
>          Components: io
>    Affects Versions: 0.2.0
>            Reporter: Doug Cutting
>         Assigned To: Michel Tourn
>             Fix For: 0.5.0
>
>
> SequenceFile will optionally compress individual values.  But both 
> compression and performance would be much better if sequences of keys and 
> values are compressed together.  Sync marks should only be placed between 
> blocks.  This will require some changes to MapFile too, so that all file 
> positions stored there are the positions of blocks, not entries within 
> blocks.  Probably this can be accomplished by adding a 
> getBlockStartPosition() method to SequenceFile.Writer.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to