You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
help?> Tables.materializer
Tables.materializer(x) => Callable
<...>
The default materializer is Tables.columntable, which converts any table input into a NamedTuple of Vectors.
It is recommended that for users implementing MyType, they define only materializer(::Type{<:MyType}). materializer(::MyType) will then
automatically delegate to this method.
Actual behavior:
julia>using StructArrays, Tables
julia> sa =StructArray(a=[1,2])
# default: returns columntable for the type, ...
julia> Tables.materializer(StructArray)
columntable (generic function with 5 methods)
# ... but rowtable for an instance
julia> Tables.materializer(sa)
rowtable (generic function with 1 method)
# if I define materializer() for the type, ...
julia> Tables.materializer(::Type{StructArray}) = StructArray ∘ columntable
# ... it works for the type ...
julia> Tables.materializer(StructArray)
StructArray ∘ Tables.columntable
# ... but still returns rowtable for an instance
julia> Tables.materializer(sa)
rowtable (generic function with 1 method)
These are not due to StructArrays doing something weird – it doesn't have materializer definitions yet. I noticed these inconsistencies when adding materializer support there, JuliaArrays/StructArrays.jl#276.
Would be nice to either fix the behavior to match the docs, or fix the docs. I'm not familiar with Tables internals, so it's hard to tell which is correct.
The text was updated successfully, but these errors were encountered:
Docs:
Actual behavior:
These are not due to StructArrays doing something weird – it doesn't have
materializer
definitions yet. I noticed these inconsistencies when addingmaterializer
support there, JuliaArrays/StructArrays.jl#276.Would be nice to either fix the behavior to match the docs, or fix the docs. I'm not familiar with Tables internals, so it's hard to tell which is correct.
The text was updated successfully, but these errors were encountered: