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/06/08 14:00:30 UTC

[arrow-julia] 01/01: Fix case of recursively nested lists

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

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

commit a988fb97302b8f79163616c83fa8541c4afdf8b0
Author: Jacob Quinn <qu...@gmail.com>
AuthorDate: Thu Jun 8 07:59:00 2023 -0600

    Fix case of recursively nested lists
    
    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.
---
 src/table.jl     | 2 +-
 test/runtests.jl | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/table.jl b/src/table.jl
index ada392d..e61445c 100644
--- a/src/table.jl
+++ b/src/table.jl
@@ -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
diff --git a/test/runtests.jl b/test/runtests.jl
index 4f84e7c..e0e974b 100644
--- a/test/runtests.jl
+++ b/test/runtests.jl
@@ -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