HedgehogCode commented on pull request #8949:
URL: https://github.com/apache/arrow/pull/8949#issuecomment-758805393


   The [comment in the BodyCompression 
protobuf](https://github.com/apache/arrow/blob/master/format/Message.fbs#L59-L65)
 states:
   > Each constituent buffer is first compressed with the indicated compressor, 
and then written with the uncompressed length in the first 8 bytes as a 64-bit 
little-endian signed integer followed by the compressed buffer bytes (and then 
padding as required by the protocol). __The uncompressed length may be set to 
-1 to indicate that the data that follows is not compressed, which can be 
useful for cases where compression does not yield appreciable savings.__
   
   Should the check for a length of -1 be made outside of `CompressionCodec` 
implementation? I think it would be useful to do it in the 
`#decompress(BufferAllocator, ArrowBuf)` method.
   
   Should be pretty easy if I don't miss something:
   ```java
       if (decompressedLength == -1L) {
         // handle uncompressed buffers
         return compressedBuffer.slice(SIZE_OF_MESSAGE_LENGTH,
             compressedBuffer.writerIndex() - SIZE_OF_MESSAGE_LENGTH);
       }
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to