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/01/10 17:09:59 UTC
[arrow-julia] branch main updated: bugfix & test for columns with VersionNumber & missing (#374)
This is an automated email from the ASF dual-hosted git repository.
quinnj pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-julia.git
The following commit(s) were added to refs/heads/main by this push:
new 528c3ba bugfix & test for columns with VersionNumber & missing (#374)
528c3ba is described below
commit 528c3ba9eaa38b7e9c1ff3d4c998f5b304ec64cf
Author: Eric Hanson <58...@users.noreply.github.com>
AuthorDate: Tue Jan 10 18:09:53 2023 +0100
bugfix & test for columns with VersionNumber & missing (#374)
* bugfix & test
* fix ArrowTypes test typo
---
Project.toml | 3 ++-
src/ArrowTypes/Project.toml | 2 +-
src/ArrowTypes/src/ArrowTypes.jl | 1 +
src/ArrowTypes/test/tests.jl | 1 +
test/runtests.jl | 15 +++++++++++++++
5 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/Project.toml b/Project.toml
index e10125c..f60b87c 100644
--- a/Project.toml
+++ b/Project.toml
@@ -57,7 +57,8 @@ FilePathsBase = "48062228-2e41-5def-b9a4-89aafe57970f"
JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
StructTypes = "856f2bd8-1eba-4b0a-8007-ebc267875bd4"
+TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
[targets]
-test = ["CategoricalArrays", "FilePathsBase", "JSON3", "Random", "StructTypes", "Test"]
+test = ["CategoricalArrays", "FilePathsBase", "JSON3", "Random", "StructTypes", "TOML", "Test"]
diff --git a/src/ArrowTypes/Project.toml b/src/ArrowTypes/Project.toml
index deb1b36..250338c 100644
--- a/src/ArrowTypes/Project.toml
+++ b/src/ArrowTypes/Project.toml
@@ -18,7 +18,7 @@
name = "ArrowTypes"
uuid = "31f734f8-188a-4ce0-8406-c8a06bd891cd"
authors = ["quinnj <qu...@gmail.com>"]
-version = "2.0.0"
+version = "2.0.1"
[deps]
diff --git a/src/ArrowTypes/src/ArrowTypes.jl b/src/ArrowTypes/src/ArrowTypes.jl
index 751d4f5..8c25b79 100644
--- a/src/ArrowTypes/src/ArrowTypes.jl
+++ b/src/ArrowTypes/src/ArrowTypes.jl
@@ -273,6 +273,7 @@ const VERSION_NUMBER = Symbol("JuliaLang.VersionNumber")
ArrowKind(::Type{VersionNumber}) = StructKind()
arrowname(::Type{VersionNumber}) = VERSION_NUMBER
JuliaType(::Val{VERSION_NUMBER}) = VersionNumber
+default(::Type{VersionNumber}) = v"0"
function fromarrow(::Type{VersionNumber}, v::NamedTuple)
VersionNumber(v.major, v.minor, v.patch, v.prerelease, v.build)
diff --git a/src/ArrowTypes/test/tests.jl b/src/ArrowTypes/test/tests.jl
index 172723c..f3c9c57 100644
--- a/src/ArrowTypes/test/tests.jl
+++ b/src/ArrowTypes/test/tests.jl
@@ -122,6 +122,7 @@ v_nt = (major=1, minor=0, patch=0, prerelease=(), build=())
@test ArrowTypes.arrowname(VersionNumber) == ArrowTypes.VERSION_NUMBER
@test ArrowTypes.JuliaType(Val(ArrowTypes.VERSION_NUMBER)) == VersionNumber
@test ArrowTypes.fromarrow(typeof(v), v_nt) == v
+@test ArrowTypes.default(VersionNumber) == v"0"
@test ArrowTypes.ArrowKind(Dict{String, Int}) == ArrowTypes.MapKind()
@test ArrowTypes.ArrowKind(Union{String, Int}) == ArrowTypes.UnionKind()
diff --git a/test/runtests.jl b/test/runtests.jl
index 343ee77..b040a4f 100644
--- a/test/runtests.jl
+++ b/test/runtests.jl
@@ -18,6 +18,15 @@ using Test, Arrow, ArrowTypes, Tables, Dates, PooledArrays, TimeZones, UUIDs,
CategoricalArrays, DataAPI, FilePathsBase
using Random: randstring
+# Compat shim for pre-julia 1.9
+if !@isdefined(pkgversion)
+ using TOML
+ function pkgversion(m::Module)
+ toml = TOML.parsefile(joinpath(pkgdir(m), "Project.toml"))
+ return VersionNumber(toml["version"])
+ end
+end
+
include(joinpath(dirname(pathof(ArrowTypes)), "../test/tests.jl"))
include(joinpath(dirname(pathof(Arrow)), "../test/testtables.jl"))
include(joinpath(dirname(pathof(Arrow)), "../test/testappend.jl"))
@@ -548,6 +557,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
+if pkgversion(ArrowTypes) >= v"2.0.1" # need the ArrowTypes bugfix to pass this test
+ # https://github.com/apache/arrow-julia/issues/243
+ table = (; col = [(; v=v"1"), (; v=v"2"), missing])
+ @test isequal(Arrow.Table(Arrow.tobuffer(table)).col, table.col)
+end
+
end # @testset "misc"
end