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

Recent changes in Tables.istable

Open quinnj opened this issue 6 years ago • 1 comments

Hey, just wanted to drop a note about a recent change to Tables.istable; it was originally conservative, then released to be more liberal (basically treating anything iterable as a table), and has now gone back to being conservative (in the 0.2 release). The main thing to note is that while Tables.istable is perfectly fine to use, there are a few additional cases can technically be considered tables for which istable returns false, like Generators of "Row" objects, or Vector{Any} where elements are "Row" objects.

What I would suggest is that you change the definition here to:

function _columns(x)
    try
        return columntable(x)
    catch e
        error("Cannot construct table from $(typeof(x))")
    end
end

this calls columntable directly, which will throw its own error if the input isn't Tables.jl-compatible, so you could even take out the try-catch in this example, if you're ok letting the Tables.jl error be thrown.

quinnj avatar May 04 '19 06:05 quinnj

Thanks for the heads-up Jacob. The intention here was initially to use columntable directly so when I get a moment I'll see if that pans out now.

andyferris avatar May 10 '19 12:05 andyferris