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/04 20:51:24 UTC
[arrow-julia] 01/01: Fix issue with missing and non-concrete Arrow types
This is an automated email from the ASF dual-hosted git repository.
omus pushed a commit to branch cv/non-concrete-missing-fix
in repository https://gitbox.apache.org/repos/asf/arrow-julia.git
commit a3960ae12632dc6f817aadb11fb6bdc038ef8405
Author: Curtis Vogt <cu...@gmail.com>
AuthorDate: Wed Jan 4 14:31:44 2023 -0600
Fix issue with missing and non-concrete Arrow types
---
src/ArrowTypes/src/ArrowTypes.jl | 3 +++
test/runtests.jl | 6 ++++++
2 files changed, 9 insertions(+)
diff --git a/src/ArrowTypes/src/ArrowTypes.jl b/src/ArrowTypes/src/ArrowTypes.jl
index 115c102..a35fae4 100644
--- a/src/ArrowTypes/src/ArrowTypes.jl
+++ b/src/ArrowTypes/src/ArrowTypes.jl
@@ -344,6 +344,9 @@ function ToArrow(x::A) where {A}
for i = 2:length(x)
@inbounds T = promoteunion(T, typeof(toarrow(x[i])))
end
+ if T === Missing
+ T = promoteunion(T, typeof(toarrow(default(S))))
+ end
end
return ToArrow{T, A}(x)
end
diff --git a/test/runtests.jl b/test/runtests.jl
index 343ee77..86072fc 100644
--- a/test/runtests.jl
+++ b/test/runtests.jl
@@ -548,6 +548,12 @@ original_table = (; col = [ ZonedDateTime(DateTime(1, 2, 3, 4, 5, 6), tz"UTC+3")
table = Arrow.Table(joinpath(@__DIR__, "old_zdt.arrow"))
@test original_table.col == table.col
+# https://github.com/apache/arrow-julia/issues/367
+t = (; x=Union{ZonedDateTime,Missing}[missing])
+a = Arrow.Table(Arrow.tobuffer(t))
+@test Tables.schema(a) == Tables.schema(t)
+@test isequal(a.x, t.x)
+
end # @testset "misc"
end