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

Tables.materializer with structure type arguments

Open krynju opened this issue 2 years ago • 3 comments

I was trying to obtain the sink function using only the type of the structure. Only way to do that was to create an empty structure using a constructor with no args. This assumes the structure would have one available

Is there any better way to do this?

Docs are stating a table input, so the behavior is consistent with the docs, but I think getting a sink using a type would be useful in some cases.

julia> type = DataFrame
DataFrame

julia> Tables.materializer(type)
columntable (generic function with 5 methods)

julia> Tables.materializer(type())
DataFrame

krynju avatar Aug 03 '21 20:08 krynju

I just hit exactly this same issue.

kleinschmidt avatar Aug 06 '21 17:08 kleinschmidt

Generally, the docs aren't totally clear on which interface methods take a type and which take a value, and table gets used interchangeably to refer to a type (istable) or a value (materializer)

kleinschmidt avatar Aug 06 '21 17:08 kleinschmidt

As commented in Slack, I think materializer should act on an instance, not the type, for consistency with other Tables.jl functions.

pdeffebach avatar Aug 08 '21 14:08 pdeffebach