-
Notifications
You must be signed in to change notification settings - Fork 51
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
Implement DataAPI #92
Conversation
""" | ||
Tables.allocatecolumn(::Type{T}, len) => returns a column type (usually AbstractVector) w/ size to hold `len` elements | ||
|
||
Custom column types can override with an appropriate "scalar" element type that should dispatch to their column allocator. | ||
""" | ||
allocatecolumn(T, len) = Vector{T}(undef, len) | ||
allocatecolumn(T, len) = DataAPI.defaultarray(T, 1)(undef, len) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should defaultarray
replace allocatecolumn
at some point?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
they're slightly different; defaultarray
just returns the array type for a given scalar type; allocatecolumn is for actually creating a column. We can probably just replace uses of allocatecolumn
with defaultarray(T)(undef, len)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's what I had in mind.
src/tofromdatavalues.jl
Outdated
|
||
Base.@pure function nondatavaluetype(::Type{NT}) where {NT <: NamedTuple{names}} where {names} | ||
TT = Tuple{Any[ nondatavaluetype(fieldtype(NT, i)) for i = 1:fieldcount(NT) ]...} | ||
DataAPI.nondatavaluetype(::Type{T}) where {T} = T |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know that this function is documented to be owned by Tables.jl, but given how simple this fallback definition is, why not put it in DataAPI instead? That would be simpler for everybody.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's fair.
No description provided.