Skip to content

Commit

Permalink
Fix case of recursively nested lists (#459)
Browse files Browse the repository at this point in the history
Fixes issue reported by @Moelf in #458.

The issue is we need to get the eltype from the recursively built child
array instead of as a top-level translation of the current field type.
  • Loading branch information
quinnj authored Jun 8, 2023
1 parent f039a5e commit 074c7a7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/table.jl
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ function build(f::Meta.Field, L::ListTypes, batch, rb, de, nodeidx, bufferidx, c
# juliaeltype returns Vector for List, translate to SubArray
S = Base.nonmissingtype(T)
if S <: Vector
ST = SubVector{eltype(S), typeof(A)}
ST = SubVector{eltype(A), typeof(A)}
T = S == T ? ST : Union{Missing, ST}
end
end
Expand Down
9 changes: 9 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,15 @@ t = Arrow.Table(joinpath(dirname(pathof(Arrow)), "../test/java_compressed_zero_l

end

@testset "# 458" begin

x = (; a=[[[[1]]]])
buf = Arrow.tobuffer(x)
t = Arrow.Table(buf)
@test t.a[1][1][1][1] == 1

end

end # @testset "misc"

end

0 comments on commit 074c7a7

Please sign in to comment.