Skip to content

Making Custom types documentation example work #386

@bgctw

Description

@bgctw

I try to redo the Custom Types example of the documentation, but I am not able to read proper Person types.

using Arrow: Arrow, ArrowTypes
struct Person
    id::Int
    name::String
end
ArrowTypes.arrowname(::Type{Person}) = :Person
ArrowTypes.JuliaType(::Val{:Person}) = Person

table = (col1=[Person(1, "Bob"), Person(2, "Jane")],)
io = IOBuffer()
Arrow.write(io, table)
seekstart(io)
table2 = Arrow.Table(io)
p1 = first(table2)
typeof(p1)  # Arrow.Struct{Person, ...}
p1 isa Person # false

Both with Julia 1.8.4 and 1.8.5
In an otherwise empty environment:

(jl_t4jDSi) pkg> st
Status `/tmp/jl_t4jDSi/Project.toml`
  [69666777] Arrow v2.4.2

And also with the current master (dev https://github.com/apache/arrow-julia.git)

(jl_t4jDSi) pkg> st
Status `/tmp/jl_t4jDSi/Project.toml`
  [69666777] Arrow v2.4.2 `~/julia/dev/Arrow`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions