This is an automated email from the ASF dual-hosted git repository.

alamb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git


The following commit(s) were added to refs/heads/master by this push:
     new e5c9e0d8b Fix bug in IPC logic that determines if the buffer should be 
compressed or not (#4411)
e5c9e0d8b is described below

commit e5c9e0d8b2029da0a018c80c8dba4d2e951aa7a7
Author: Li wen <[email protected]>
AuthorDate: Sat Jun 17 00:20:42 2023 +0800

    Fix bug in IPC logic that determines if the buffer should be compressed or 
not (#4411)
    
    The wrongly calculated compressed length included the full original buffer 
length, which will decline almost all the compressable data.
    Suppose original buffer len is *a*, incoming data len is *b*, compressed 
data len is *c*, the code should compare *b* and *c* instead of *b* and *a+c*
---
 arrow-ipc/src/compression.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arrow-ipc/src/compression.rs b/arrow-ipc/src/compression.rs
index dd60bfdee..db05e9a6a 100644
--- a/arrow-ipc/src/compression.rs
+++ b/arrow-ipc/src/compression.rs
@@ -69,7 +69,7 @@ impl CompressionCodec {
             output.extend_from_slice(&uncompressed_data_len.to_le_bytes());
             self.compress(input, output)?;
 
-            let compression_len = output.len();
+            let compression_len = output.len() - original_output_len;
             if compression_len > uncompressed_data_len {
                 // length of compressed data was larger than
                 // uncompressed data, use the uncompressed data with

Reply via email to