From 64ff30f360e52f63852150fa6fb2b9fdced9f6bf Mon Sep 17 00:00:00 2001 From: zzq09494 Date: Tue, 26 Sep 2017 09:54:03 +0800 Subject: [PATCH] add check compressor's byte size when finish compress --- .../org/apache/hadoop/io/compress/BlockCompressorStream.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/BlockCompressorStream.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/BlockCompressorStream.java index 434183bbc25..f2c26c190e2 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/BlockCompressorStream.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/BlockCompressorStream.java @@ -135,7 +135,7 @@ public class BlockCompressorStream extends CompressorStream { @Override public void finish() throws IOException { - if (!compressor.finished()) { + if (!compressor.finished() && compressor.getBytesRead() > 0) { rawWriteInt((int)compressor.getBytesRead()); compressor.finish(); while (!compressor.finished()) {