diff --git a/src/table.jl b/src/table.jl index ff44f058..49b61536 100644 --- a/src/table.jl +++ b/src/table.jl @@ -521,11 +521,12 @@ 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 + if len == -1 # len = -1 means data is not compressed + # it's unclear why other language implementations allow this + # but we support to be able to read data produced as such return length(encodedbytes), copy(encodedbytes) end - decodedbytes = Vector{UInt8}(undef, len) if compression.codec === Meta.CompressionTypes.LZ4_FRAME transcode(LZ4FrameDecompressor, encodedbytes, decodedbytes) diff --git a/test/java_compress_len_neg_one.arrow b/test/java_compress_len_neg_one.arrow new file mode 100644 index 00000000..1d0f864d Binary files /dev/null and b/test/java_compress_len_neg_one.arrow differ diff --git a/test/runtests.jl b/test/runtests.jl index 3cdac88b..47a137f0 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -666,6 +666,14 @@ t2 = Arrow.Table(buf2) end +@testset "# 435" begin + +t = Arrow.Table(joinpath(dirname(pathof(Arrow)), "../test/java_compress_len_neg_one.arrow")) +@test length(t) == 15 +@test length(t.isA) == 102 + +end + end # @testset "misc" end