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 63d2c9d fix arrowname and arrowmetadata for nullable types (#389)
63d2c9d is described below
commit 63d2c9d3ca4539a0ea831ae8ecafa71b051d475d
Author: Ben Baumgold <[email protected]>
AuthorDate: Sat Mar 4 23:19:59 2023 -0500
fix arrowname and arrowmetadata for nullable types (#389)
---
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 1351166..130e07e 100644
--- a/src/ArrowTypes/src/ArrowTypes.jl
+++ b/src/ArrowTypes/src/ArrowTypes.jl
@@ -102,6 +102,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
@@ -113,7 +117,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