I am using below code snippet for sequence file writer but it works fine if sequence file doesn't exist but it does then it overwrites the content rather than appending to it.
SequenceFile.Writer writer = SequenceFile.createWriter(FileContext.getFileContext(conf), conf, sequenceFile, Text.class, Text.class, CompressionType.NONE, null, new Metadata(), EnumSet.of(CreateFlag.CREATE, CreateFlag.APPEND));
Please note: I am using hadoop 2.7.2.
Can anyone please help on how do I append to an existing sequence file?
Also I tried below option as well but no luck:
Writer writer = SequenceFile.createWriter(conf, SequenceFile.Writer.file(sequenceFile), SequenceFile.Writer.keyClass(Text.class), SequenceFile.Writer.valueClass(Text.class), SequenceFile.Writer.appendIfExists(true), metadataOption);
Thanks in Advance!
Use
Writer
in case of SequenceFile.Writer like this:And then use the its append method.
I hope this link may help You.
Here is the link Allow appending to existing SequenceFiles. The issue has been solved in 2.7.2