You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by om...@apache.org on 2023/01/29 04:33:22 UTC

[arrow-julia] branch cv/abstract-default-fix created (now e3a29db)

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

omus pushed a change to branch cv/abstract-default-fix
in repository https://gitbox.apache.org/repos/asf/arrow-julia.git


      at e3a29db  Fix ToArrow with abstract type and all missing

This branch includes the following new commits:

     new e3a29db  Fix ToArrow with abstract type and all missing

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[arrow-julia] 01/01: Fix ToArrow with abstract type and all missing

Posted by om...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

omus pushed a commit to branch cv/abstract-default-fix
in repository https://gitbox.apache.org/repos/asf/arrow-julia.git

commit e3a29db0d26e7bbdd92fb5b8eb112b7138b084b7
Author: Curtis Vogt <cu...@gmail.com>
AuthorDate: Sat Jan 28 19:19:15 2023 -0600

    Fix ToArrow with abstract type and all missing
---
 src/ArrowTypes/src/ArrowTypes.jl | 2 +-
 src/ArrowTypes/test/tests.jl     | 9 ++++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/ArrowTypes/src/ArrowTypes.jl b/src/ArrowTypes/src/ArrowTypes.jl
index f4f9e39..43c9c10 100644
--- a/src/ArrowTypes/src/ArrowTypes.jl
+++ b/src/ArrowTypes/src/ArrowTypes.jl
@@ -349,7 +349,7 @@ function ToArrow(x::A) where {A}
         for i = 2:length(x)
             @inbounds T = promoteunion(T, typeof(toarrow(x[i])))
         end
-        if T === Missing
+        if T === Missing && concrete_or_concreteunion(S)
             T = promoteunion(T, typeof(toarrow(default(S))))
         end
     end
diff --git a/src/ArrowTypes/test/tests.jl b/src/ArrowTypes/test/tests.jl
index d1e1914..71be73e 100644
--- a/src/ArrowTypes/test/tests.jl
+++ b/src/ArrowTypes/test/tests.jl
@@ -164,7 +164,7 @@ v_nt = (major=1, minor=0, patch=0, prerelease=(), build=())
     @test eltype(x) == Union{Float64, String}
     @test x == [1.0, 3.14, "hey"]
 
-    @testset "respect non-missing type" begin
+    @testset "respect non-missing concrete type" begin
         struct DateTimeTZ
             instant::Int64
             tz::String
@@ -187,6 +187,13 @@ v_nt = (major=1, minor=0, patch=0, prerelease=(), build=())
         # would break this test by returning `Union{Nothing,Missing}`.
         @test eltype(ArrowTypes.ToArrow(Any[missing])) == Missing
     end
+
+    @testset "ignore non-missing abstract type" begin
+        x = ArrowTypes.ToArrow(Union{Missing,Array{Int}}[missing])
+        @test x isa ArrowTypes.ToArrow{Missing, Vector{Union{Missing, Array{Int64}}}}
+        @test eltype(x) == Missing
+        @test isequal(x, [missing])
+    end
 end
 
 end