Skip to content

Commit

Permalink
bugfix writetable: replace Tables.istable static check with runtime c…
Browse files Browse the repository at this point in the history
…heck
  • Loading branch information
felipenoris committed Jul 27, 2022
1 parent 2af820f commit 06f2e8f
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/tables_interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@ Tables.getcolumn(tr::TableRow, i::Integer) = getdata(tr, i)
_as_vector(y::AbstractVector) = y
_as_vector(y) = collect(y)

@generated function _table_to_arrays(x)
function _table_to_arrays(x)
if Tables.istable(x)
return quote
columns = Any[_as_vector(c) for c in Tables.Columns(x)]
names = collect(Symbol, Tables.columnnames(x))
return columns, names
end
colnames = collect(Symbol, Tables.columnnames(x))
return columns, colnames
else
error("$x does not implement Tables.jl interface.")
error("$(typeof(x)) does not implement Tables.jl interface.")
end
end

Expand Down

0 comments on commit 06f2e8f

Please sign in to comment.