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

ERROR: MethodError: no method matching zero(::Type{Union{Nothing, String}}) when trying to serialize Union{Nothing,String} fields #368

Closed
jrevels opened this issue Dec 23, 2022 · 1 comment

Comments

@jrevels
Copy link
Contributor

jrevels commented Dec 23, 2022

MWE:

julia> using Arrow

julia> t = (; x = Union{Missing,NamedTuple{(:k,),Tuple{Union{Nothing,String}}}}[missing, (; k = "k")])
(x = Union{Missing, NamedTuple{(:k,), Tuple{Union{Nothing, String}}}}[missing, NamedTuple{(:k,), Tuple{Union{Nothing, String}}}(("k",))],)

julia> a = Arrow.Table(Arrow.tobuffer(t))
ERROR: MethodError: no method matching zero(::Type{Union{Nothing, String}})
Closest candidates are:
  zero(::Union{Type{P}, P}) where P<:Dates.Period at /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/Dates/src/periods.jl:53
  zero(::AbstractIrrational) at irrationals.jl:150
  zero(::CartesianIndex{N}) where N at multidimensional.jl:106
  ...
Stacktrace:
  [1] default(T::Type)
    @ ArrowTypes ~/.julia/packages/ArrowTypes/dkiHE/src/ArrowTypes.jl:305
  [2] getindex
    @ ~/.julia/packages/Arrow/QsQ3U/src/arraytypes/struct.jl:80 [inlined]
  [3] iterate
    @ ./abstractarray.jl:1167 [inlined]
  [4] iterate
    @ ./abstractarray.jl:1165 [inlined]
  [5] iterate
    @ ./iterators.jl:167 [inlined]
  [6] iterate
    @ ./iterators.jl:166 [inlined]
  [7] todense(#unused#::Type{Arrow.UnionT{Arrow.Flatbuf.UnionModes.Dense, nothing, Tuple{Nothing, String}}}, x::Arrow.ToStruct{Union{Nothing, String}, 1, Vector{Union{Missing, NamedTuple{(:k,), Tuple{Union{Nothing, String}}}}}})
    @ Arrow ~/.julia/packages/Arrow/QsQ3U/src/arraytypes/unions.jl:112
  [8] arrowvector(::ArrowTypes.UnionKind, x::Arrow.DenseUnionVector{Arrow.ToStruct{Union{Nothing, String}, 1, Vector{Union{Missing, NamedTuple{(:k,), Tuple{Union{Nothing, String}}}}}}, Tuple{Nothing, String}}, i::Int64, nl::Int64, fi::Int64, de::Dict{Int64, Any}, ded::Vector{Arrow.DictEncoding}, meta::Nothing; kw::Base.Pairs{Symbol, Union{Nothing, Integer}, NTuple{6, Symbol}, NamedTuple{(:dictencode, :maxdepth, :denseunions, :compression, :largelists, :dictencodenested), Tuple{Bool, Int64, Bool, Nothing, Bool, Bool}}})
    @ Arrow ~/.julia/packages/Arrow/QsQ3U/src/arraytypes/unions.jl:219

This might be tangential, but it's a bit confusing to me when a method for default is actually needed or not; it has a docstring, but it doesn't show up in the manual IIRC

@quinnj
Copy link
Member

quinnj commented Jun 13, 2023

This is fixed

@quinnj quinnj closed this as completed Jun 13, 2023
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

2 participants