You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by qu...@apache.org on 2023/05/22 22:44:35 UTC

[arrow-julia] branch main updated: Add handling of len = -1 in uncompress (#436)

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

quinnj pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-julia.git


The following commit(s) were added to refs/heads/main by this push:
     new 94749c0  Add handling of len = -1 in uncompress (#436)
94749c0 is described below

commit 94749c07d96cf69659e079f8f0702913f8ed76d9
Author: DrChainsaw <36...@users.noreply.github.com>
AuthorDate: Tue May 23 00:44:29 2023 +0200

    Add handling of len = -1 in uncompress (#436)
    
    Fix #435
    
    Hipshot PR from the github API. Not sure how to add tests for this if
    needed. It reads my files correctly at least :)
---
 src/table.jl | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/table.jl b/src/table.jl
index 5f4678d..ff44f05 100644
--- a/src/table.jl
+++ b/src/table.jl
@@ -521,6 +521,11 @@ function uncompress(ptr::Ptr{UInt8}, buffer, compression)
     len = unsafe_load(convert(Ptr{Int64}, ptr))
     ptr += 8 # skip past uncompressed length as Int64
     encodedbytes = unsafe_wrap(Array, ptr, buffer.length - 8)
+    if len === -1
+        # len = -1 means data is not compressed
+        return length(encodedbytes), copy(encodedbytes)
+    end
+                                        
     decodedbytes = Vector{UInt8}(undef, len)
     if compression.codec === Meta.CompressionTypes.LZ4_FRAME
         transcode(LZ4FrameDecompressor, encodedbytes, decodedbytes)