Skip to content

Commit

Permalink
Use standard Tables.Schema constructor instead of constructing directly
Browse files Browse the repository at this point in the history
This is part of fixing errors like
JuliaData/CSV.jl#635 in addition to the
changes to support really wide tables in
JuliaData/Tables.jl#241. Luckily, there aren't
many cases I've found across Tables.jl implementations that make working
with really wide tables impossible, but this was a key place where for
really wide tables, we want the names/types to be stored as `Vector`s
instead of `Tuple`/`Tuple{}` in `Tables.Schema`. This shouldn't have any
noticeable change/affect for non-wide DataFrames and should be covered
by existing tests.
  • Loading branch information
quinnj committed Jun 22, 2021
1 parent 818cb11 commit 3dc8105
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/other/tables.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ end
Tables.columnindex(df::Union{AbstractDataFrame, DataFrameRow}, idx::AbstractString) =
columnindex(df, Symbol(idx))

Tables.schema(df::AbstractDataFrame) = Tables.Schema{Tuple(_names(df)), Tuple{[eltype(col) for col in eachcol(df)]...}}()
Tables.schema(df::AbstractDataFrame) = Tables.Schema(_names(df), [eltype(col) for col in eachcol(df)])
Tables.materializer(df::AbstractDataFrame) = DataFrame

Tables.getcolumn(df::AbstractDataFrame, i::Int) = df[!, i]
Expand Down

0 comments on commit 3dc8105

Please sign in to comment.