Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge remote branch 'kevinweil/master'

  • Loading branch information...
commit fff551892474100458c819dbe3e86ca279a9969a 2 parents e59cf95 + 927df21
Travis Crawford traviscrawford authored
2  build.xml
@@ -28,7 +28,7 @@
28 28
29 29 <property name="Name" value="Hadoop GPL Compression"/>
30 30 <property name="name" value="hadoop-lzo"/>
31   - <property name="version" value="0.4.10"/>
  31 + <property name="version" value="0.4.11"/>
32 32 <property name="final.name" value="${name}-${version}"/>
33 33 <property name="year" value="2008"/>
34 34
2  src/java/com/hadoop/compression/lzo/LzopOutputStream.java
@@ -177,7 +177,7 @@ protected void compress() throws IOException {
177 177 // the LZO specification says that we should write the uncompressed bytes rather
178 178 // than the compressed bytes. The decompressor understands this because both sizes
179 179 // get written to the stream.
180   - if (compressor.getBytesRead() < compressor.getBytesWritten()) {
  180 + if (compressor.getBytesRead() <= compressor.getBytesWritten()) {
181 181 // Compression actually increased the size of the buffer, so write the uncompressed bytes.
182 182 byte[] uncompressed = ((LzoCompressor)compressor).uncompressedBytes();
183 183 rawWriteInt(uncompressed.length);
20 src/test/com/hadoop/compression/lzo/TestLzopOutputStream.java
@@ -46,6 +46,7 @@
46 46 private final String bigFile = "100000.txt";
47 47 private final String mediumFile = "1000.txt";
48 48 private final String smallFile = "100.txt";
  49 + private final String issue20File = "issue20-lzop.txt";
49 50
50 51 @Override
51 52 protected void setUp() throws Exception {
@@ -85,6 +86,25 @@ public void testSmallFile() throws NoSuchAlgorithmException, IOException,
85 86 }
86 87
87 88 /**
  89 + * The LZO specification says that we should write the uncompressed bytes
  90 + * rather than the compressed bytes if the compressed buffer is actually
  91 + * larger ('&gt;') than the uncompressed buffer.
  92 + *
  93 + * To conform to the standard, this means we have to write the uncompressed
  94 + * bytes also when they have exactly the same size as the compressed bytes.
  95 + * (the '==' in '&lt;=').
  96 + *
  97 + * The input data of this test is known to compress to the same size as the
  98 + * uncompressed data. Hence we verify that we handle the boundary condition
  99 + * correctly.
  100 + *
  101 + */
  102 + public void testIssue20File() throws NoSuchAlgorithmException, IOException,
  103 + InterruptedException {
  104 + runTest(issue20File);
  105 + }
  106 +
  107 + /**
88 108 * Test that reading an lzo-compressed file produces the same lines as reading the equivalent
89 109 * flat file. The test opens both the compressed and flat file, successively reading each
90 110 * line by line and comparing.
6 src/test/data/issue20-lzop.txt
... ... @@ -0,0 +1,6 @@
  1 +0.5 74 25425
  2 +0.9 200 25384
  3 +0.95 203 4
  4 +0.98 211 2
  5 +0.99 219 3
  6 +0.995 240 5

0 comments on commit fff5518

Please sign in to comment.
Something went wrong with that request. Please try again.