-
Notifications
You must be signed in to change notification settings - Fork 9
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
schema fails when selecting columns from a really wide table #20
Comments
The following naive solution should do the trick. Maybe someone has a better fix? function typesubset(sch::Tables.Schema{nothing, nothing}, nms::NTuple{N, Symbol}) where {N}
names = sch.names
types = sch.types
return Tuple{Any[Tables.columntype(names, types, nm) for nm in nms]...}
end
function typesubset(sch::Tables.Schema{nothing, nothing}, inds::NTuple{N, Int}) where {N}
types = sch.types
return Tuple{Any[types[i] for i in inds]...}
end
typesubset(::Tables.Schema{nothing, nothing}, ::Tuple{}) = Tuple{}
namesubset(::Tables.Schema{nothing, nothing}, nms::NTuple{N, Symbol}) where {N} = nms
Base.@pure namesubset(::Tables.Schema{nothing, nothing}, inds::NTuple{N, Int}) where {N} = (names = sch.names; ntuple(i -> names[inds[i]], N))
namesubset(::Tables.Schema{nothing, nothing}, ::Tuple{}) = ()
|
It should be noted that the threshold where Tables.jl will switch to this alternative Anyway, that aside, yes, we should fix the case here. I just wanted to clarify that this kind of operation didn't work before anyway. |
Started with code suggested by @OkonSamuel in issue #20. Made some tweaks and added some tests and this seems to work now.
PR up: #22 |
Started with code suggested by @OkonSamuel in issue #20. Made some tweaks and added some tests and this seems to work now.
Hello
Due to a recent change in
Tables.jl
developers now need to also consider specializing onTables.Schema{nothing, nothing}
in addition toTables.Schema{names, types}
. see here.Users will eventually pop into this error when selecting a few columns from a really wide table as shown below.
The text was updated successfully, but these errors were encountered: