[ http://issues.apache.org/jira/browse/HADOOP-54?page=comments#action_12422049 ] Doug Cutting commented on HADOOP-54: ------------------------------------
SequenceFile already has an API for reading and writing raw keys and values: http://lucene.apache.org/hadoop/docs/api/org/apache/hadoop/io/SequenceFile.Reader.html#next(org.apache.hadoop.io.DataOutputBuffer) http://lucene.apache.org/hadoop/docs/api/org/apache/hadoop/io/SequenceFile.Writer.html#append(byte[],%20int,%20int,%20int) So it's easy to write an InputFormat or OutputFormat for entries that do not encode their own length. Writable implementations must encode their length in order to be easily nestable: if a key contains a struct with string, int and long values, then the lenghts of the nested strings must be explicitly written. If we're really worried about redundant lengths, we could add a RawWritable sub-interface that adds something like rawLength(), rawWrite(DataOutput), and rawRead(DataInput, int length). (This is roughly what Owen referred to.) I don't think we should worry about padding to DFS block boundaries in the first implementation, but rather leave that as a subsequent optimization. I'm +1 for Owen's pro[osed format. > 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
