Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom type cannot round trip (Colors.jl) #484

Open
Moelf opened this issue Aug 30, 2023 · 1 comment
Open

Custom type cannot round trip (Colors.jl) #484

Moelf opened this issue Aug 30, 2023 · 1 comment

Comments

@Moelf
Copy link
Contributor

Moelf commented Aug 30, 2023

julia> using Colors, Arrow

julia> colors = fill(colorant"red", 10)
10-element Array{RGB{N0f8},1} with eltype RGB{FixedPointNumbers.N0f8}:
 RGB{N0f8}(1.0,0.0,0.0)
 RGB{N0f8}(1.0,0.0,0.0)
 RGB{N0f8}(1.0,0.0,0.0)
 RGB{N0f8}(1.0,0.0,0.0)
 RGB{N0f8}(1.0,0.0,0.0)
 RGB{N0f8}(1.0,0.0,0.0)
 RGB{N0f8}(1.0,0.0,0.0)
 RGB{N0f8}(1.0,0.0,0.0)
 RGB{N0f8}(1.0,0.0,0.0)
 RGB{N0f8}(1.0,0.0,0.0)

julia> ArrowTypes.JuliaType(::Val{:Color}) = RGB{Colors.N0f8}

julia> ArrowTypes.arrowname(::Type{RGB{Colors.N0f8}}) = :Color

julia> df = (c = colors,);

julia> a = tempname();

julia> Arrow.write(a, df)
"/tmp/jl_kVGtyjAbml"

julia> Arrow.Table(a)
Arrow.Table with 10 rows, 1 columns, and schema:
 :c  RGB{FixedPointNumbers.N0f8}

julia> Arrow.Table(a).c
10-element Arrow.Struct{RGB{FixedPointNumbers.N0f8}, Tuple{Arrow.Struct{@NamedTuple{i::UInt8}, Tuple{Arrow.Primitive{UInt8, Vector{UInt8}}}}, Arrow.Struct{@NamedTuple{i::UInt8}, Tuple{Arrow.Primitive{UInt8, Vector{UInt8}}}}, Arrow.Struct{@NamedTuple{i::UInt8}, Tuple{Arrow.Primitive{UInt8, Vector{UInt8}}}}}}:
Error showing value of type Arrow.Struct{RGB{FixedPointNumbers.N0f8}, Tuple{Arrow.Struct{@NamedTuple{i::UInt8}, Tuple{Arrow.Primitive{UInt8, Vector{UInt8}}}}, Arrow.Struct{@NamedTuple{i::UInt8}, Tuple{Arrow.Primitive{UInt8, Vector{UInt8}}}}, Arrow.Struct{@NamedTuple{i::UInt8}, Tuple{Arrow.Primitive{UInt8, Vector{UInt8}}}}}}:
ERROR: MethodError: no method matching RGB{FixedPointNumbers.N0f8}(::@NamedTuple{i::UInt8}, ::@NamedTuple{i::UInt8}, ::@NamedTuple{i::UInt8})

Closest candidates are:
  RGB{T}(::T, ::T, ::T) where T
   @ ColorTypes ~/.julia/packages/ColorTypes/1dGw6/src/types.jl:97
  RGB{T}(::Any) where T
   @ ColorTypes ~/.julia/packages/ColorTypes/1dGw6/src/types.jl:465

Stacktrace:
  [1] fromarrow(::Type{RGB{FixedPointNumbers.N0f8}}, ::@NamedTuple{i::UInt8}, ::@NamedTuple{i::UInt8}, ::@NamedTuple{i::UInt8})
    @ ArrowTypes ~/.julia/packages/ArrowTypes/Nb4EC/src/ArrowTypes.jl:168
@Moelf
Copy link
Contributor Author

Moelf commented Feb 1, 2024

bump

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant