From 85524605c5dcdc6688331a574cfdee2af9c8e81b Mon Sep 17 00:00:00 2001 From: Ben Baumgold <4933671+baumgold@users.noreply.github.com> Date: Tue, 7 Feb 2023 21:15:51 -0500 Subject: [PATCH] fix arrowname and arrowmetadata for nullable types --- src/ArrowTypes/src/ArrowTypes.jl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/ArrowTypes/src/ArrowTypes.jl b/src/ArrowTypes/src/ArrowTypes.jl index 43c9c10d..877d86e9 100644 --- a/src/ArrowTypes/src/ArrowTypes.jl +++ b/src/ArrowTypes/src/ArrowTypes.jl @@ -101,6 +101,10 @@ function arrowname end const EMPTY_SYMBOL = Symbol() arrowname(T) = EMPTY_SYMBOL hasarrowname(T) = arrowname(T) !== EMPTY_SYMBOL +arrowname(::Type{Union{T,Missing}}) where {T} = arrowname(T) +arrowname(::Type{Union{T,Nothing}}) where {T} = arrowname(T) +arrowname(::Type{Missing}) = EMPTY_SYMBOL +arrowname(::Type{Any}) = EMPTY_SYMBOL """ ArrowTypes.arrowmetadata(T) => String @@ -112,7 +116,13 @@ kinds of types when deserializing, these type parameters can be stored by defini This will then be available to access by overloading `ArrowTypes.JuliaType(::Val{Symbol(name)}, S, arrowmetadata::String)`. """ function arrowmetadata end -arrowmetadata(T) = "" +const EMPTY_STRING = "" +arrowmetadata(T) = EMPTY_STRING +arrowmetadata(::Type{Union{T,Missing}}) where {T} = arrowmetadata{T} +arrowmetadata(::Type{Union{T,Nothing}}) where {T} = arrowmetadata{T} +arrowmetadata(::Type{Nothing}) = EMPTY_STRING +arrowmetadata(::Type{Missing}) = EMPTY_STRING +arrowmetadata(::Type{Any}) = EMPTY_STRING """ ArrowTypes.JuliaType(::Val{Symbol(name)}, ::Type{S}, arrowmetadata::String) = T