Hello,
I'm using BulkWriter to write newline-delimited, LZO-compressed files. The
logic is very straightforward (See code below).

I am experiencing an issue decompressing the created files created in this
manner, consistently getting "lzop: unexpected end of file". Is this an
issue with caller of BulkWriter?

(As an aside), using com.hadoop.compression.lzo.LzoCodec instead results in
gibberish. I'm very confused what is going on.

private final CompressionOutputStream compressedStream;

public BulkRecordLZOSerializer(OutputStream stream) {
    CompressionCodecFactory factory = new CompressionCodecFactory(new
Configuration());
    try {
        compressedStream =
factory.getCodecByClassName("com.hadoop.compression.lzo.LzopCodec").createOutputStream(stream);
    } catch (IOException e) {
        throw new IllegalStateException("Unable to create LZO OutputStream");
    }
}

public void addElement(KafkaRecord record) throws IOException {
    compressedStream.write(record.getValue());
    compressedStream.write('\n');
}

public void finish() throws IOException {
    compressedStream.finish();
}

public void flush() throws IOException {
    compressedStream.flush();
}

Reply via email to