I like using StructArrays.jl for data manipulation. Converting a StructVector to a NamedTuple is basically free because of how StructArray is implemented. There are a number of Tables.jl types that work like this.
I wonder if we could relax the data input type annotation on dict2columns? This would allow us to insert iterators of anything that validly implements Base.keys and Base.pairs (e.g. NamedTuple).
I tried this change to src/Query.jl and it doesn't break any existing test cases:
function dict2columns(
- dict::Dict{Symbol, T} where T,
+ dict,
valid_columns::Dict{Symbol, String},
)::Vector{Column}
...
[
Column(string(name), valid_columns[name], column)
- for (name, column) ∈ dict
+ for (name, column) ∈ pairs(dict)
]
end
Maybe a simple stopgap until Tables.jl integration.
I like using StructArrays.jl for data manipulation. Converting a
StructVectorto aNamedTupleis basically free because of howStructArrayis implemented. There are a number of Tables.jl types that work like this.I wonder if we could relax the data input type annotation on
dict2columns? This would allow us to insert iterators of anything that validly implementsBase.keysandBase.pairs(e.g.NamedTuple).I tried this change to
src/Query.jland it doesn't break any existing test cases:Maybe a simple stopgap until Tables.jl integration.