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 21:11:48 UTC

[arrow-julia] branch cv/default-missing-nothing created (now 965a2d7)

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

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


      at 965a2d7  Define defaults for Missing/Nothing

This branch includes the following new commits:

     new 965a2d7  Define defaults for Missing/Nothing

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: Define defaults for Missing/Nothing

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

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

commit 965a2d7a63293dec7bbb97c4736e03d6bf50d3c8
Author: Curtis Vogt <cu...@gmail.com>
AuthorDate: Wed Jan 4 15:11:30 2023 -0600

    Define defaults for Missing/Nothing
---
 src/ArrowTypes/src/ArrowTypes.jl | 4 ++++
 src/ArrowTypes/test/tests.jl     | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/src/ArrowTypes/src/ArrowTypes.jl b/src/ArrowTypes/src/ArrowTypes.jl
index 115c102..751d4f5 100644
--- a/src/ArrowTypes/src/ArrowTypes.jl
+++ b/src/ArrowTypes/src/ArrowTypes.jl
@@ -304,7 +304,11 @@ default(::Type{Symbol}) = Symbol()
 default(::Type{Char}) = '\0'
 default(::Type{<:AbstractString}) = ""
 default(::Type{Any}) = nothing
+default(::Type{Missing}) = missing
+default(::Type{Nothing}) = nothing
 default(::Type{Union{T, Missing}}) where {T} = default(T)
+default(::Type{Union{T, Nothing}}) where {T} = default(T)
+default(::Type{Union{T, Missing, Nothing}}) where {T} = default(T)
 
 function default(::Type{A}) where {A <: AbstractVector{T}} where {T}
     a = similar(A, 1)
diff --git a/src/ArrowTypes/test/tests.jl b/src/ArrowTypes/test/tests.jl
index 7552d89..172723c 100644
--- a/src/ArrowTypes/test/tests.jl
+++ b/src/ArrowTypes/test/tests.jl
@@ -130,7 +130,11 @@ v_nt = (major=1, minor=0, patch=0, prerelease=(), build=())
 @test ArrowTypes.default(Symbol) == Symbol()
 @test ArrowTypes.default(Char) == '\0'
 @test ArrowTypes.default(String) == ""
+@test ArrowTypes.default(Missing) === missing
+@test ArrowTypes.default(Nothing) === nothing
 @test ArrowTypes.default(Union{Int, Missing}) == Int(0)
+@test ArrowTypes.default(Union{Int, Nothing}) == Int(0)
+@test ArrowTypes.default(Union{Int, Missing, Nothing}) == Int(0)
 
 @test ArrowTypes.promoteunion(Int, Float64) == Float64
 @test ArrowTypes.promoteunion(Int, String) == Union{Int, String}