JuliaDB.jl icon indicating copy to clipboard operation
JuliaDB.jl copied to clipboard

eltype not type stable

Open bkamins opened this issue 7 years ago • 2 comments
trafficstars

Currently (Julia 0.6) eltype on table with undefined column names returns a Tuple and eltype for defined column names is NamedTuple. Maybe it could be unified for NamedTuple always. This would then work well with Tables.jl.

bkamins avatar Aug 26 '18 16:08 bkamins

eltype(table) is type stable:

julia> @inferred eltype(table((x=1:5,y=1:5)))
NamedTuple{(:x, :y),Tuple{Int64,Int64}}

julia> @inferred eltype(table(1:5, 1:5))
Tuple{Int64,Int64}

That being said, I'm 100% on board for forcing the eltype to be a named tuple.

joshday avatar Nov 28 '18 15:11 joshday

That being said, I'm 100% on board for forcing the eltype to be a named tuple.

Definitely. Having tuples for rows may be technically difficult with missing data as, given that they are covariant, there is no easy way of having rows be of constant type when iterating.

piever avatar Nov 28 '18 15:11 piever