Poncito opened a new issue #281:
URL: https://github.com/apache/arrow-julia/issues/281
Hello,
I have a custom type defined this way:
```julia
struct Char8 <: AbstractChar
x::UInt8
end
Char8(x::Integer) = Char8(UInt8(x))
Char8(x::AbstractChar) = Char8(UInt8(x))
Base.codepoint(c::Char8) = UInt32(c.x)
Base.isvalid(::Type{Char8}, x::UInt8) = true
Base.isvalid(::Type{Char8}, x::Integer) = isvalid(UInt8, x)
Base.isvalid(::Type{Char8}, x::AbstractChar) = isvalid(UInt8, x)
```
and serialized this way
```julia
ArrowTypes.ArrowKind(::Type{Char8}) = ArrowTypes.PrimitiveKind()
ArrowTypes.ArrowType(::Type{Char8}) = UInt8
const CHAR8 = Symbol("JuliaLang.Char8")
ArrowTypes.arrowname(::Type{Char8}) = CHAR8
ArrowTypes.toarrow(x::Char8) = x.x
ArrowTypes.fromarrow(::Type{Char8}, x::UInt8) = Char8(x)
ArrowTypes.JuliaType(::Val{CHAR8}) = Char8
```
The following throws:
```julia
a=[(Char8(1),Char8(2))]
table = (col1=a,)
io = IOBuffer()
Arrow.write(io, table;compress=:zstd)
```
but only when the compression is enabled. Is that expected?
I also noticed that the ArrowType seems wrong, because it calls the identity
function.
So, why not setting the following default,
```ArrowTypes.ArrowType(::Type{NTuple{N, T}}) where {N, T} = NTuple{N,
ArrowTypes.ArrowType(T)}``` ?
This line solves this issue in my case.
Thanks,
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]