Hi,
I am using the code below to append key/value pairs from a SequenceFile to
an HFile.
The problem is that I don't include offset and length information.
In the old api (0.20.2), there was a method
*append<http://people.apache.org/%7Epsmith/hbase/sandbox/hbase/apidocs/org/apache/hadoop/hbase/io/hfile/HFile.Writer.html#append%28byte[],%20int,%20int,%20byte[],%20int,%20int%29>
*(byte[] key, int koffset, int klength, byte[] value, int voffset,
int vlength)
so I would replace line 7. below by hfileWriter.append(key.getBytes(), 0,
key.getLength(), valueBytes, 0, valueBytes.length);
How do I do this with the newer api (0.92) ? Thank you very much.
Best regards,
Juan
1. HFile.WriterFactory hfileWriterFactory = HFile.getWriterFactory(conf);
2. HFile.Writer hfileWriter = hfileWriterFactory.createWriter(fs, path, 64
* 1024, "gz", null);
3. BytesWritable key = new BytesWritable();
4. ArrayWritable value = new ArrayWritable(IntWritable.class);
5. while (sequenceReader.next(key, value)) {
6. byte[] valueBytes = Util.object2ByteArray(value);
7. hfileWriter.append(key.getBytes(), valueBytes);
8. }