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

Sorry for being dense. I missed the fact that you wanted to preserve key-value 
pair compression as an option.

I'd propose spliting the classes like:

SequenceFile.Writer  // uncompressed
SequenceFile.RecordCompressWriter  extends Writer
SequenceFile.BlockCompressWriter  extends Writer

They would have the current interface, with the following new functions:

  void append(byte[] key, int keyOffset, int keyLength, byte[] value, int 
valueOffset, int valueLength);
  boolean canAppendCompressed();
  void appendCompressed(byte[] key, int keyOffset, int keyLength, 
                                                 byte[] value, int valueOffset, 
int valueLength);

when we add custom compressors, we can add the compressor to the constructors.

 The Reader should have methods like:

   boolean next(DataOutputStream key, DataOutputStream value);
   boolean canReadCompressed();
   void readCompressed(DataOutputStream key, DataOutputStream value);

when we add custom compressors, we can add a getter for them like:
   StreamCompressor getCompressor();

As an implementation, I'd consider having SequenceFile.Reader be a bridge to 
the class that is doing the reading based on the how it is compressed.

Thoughts?

> 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: Arun C Murthy
>             Fix For: 0.5.0
>
>         Attachments: VIntCompressionResults.txt
>
>
> 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