Tables.jl
Tables.jl copied to clipboard
RFC: allow column access by `AbstractString`
Tables.jl currently supports column access by Integer
s and Symbol
s. Many implementations use Symbol
s to keep track of column names, such as DataFrames.Index
. However, generating too many unique Symbol
s can lead to memory leaks because Symbol
s are not garbage collected.
This calls for implementations which use something else, such as String
s or InlineString
s.
Could we add indexing by AbstractString
s to the Tables.jl specification? There could be a fallback definition
getcolumn(t, nm::AbstractString) = getcolumn(t, Symbol(nm))
but it would be possible to overload this function for a custom table type in order to bypass the conversion to Symbol
s.
Providing a method for the second argument being of type Symbol
would still be mandatory.
In this way, an application consuming the Tables.jl API could use Symbol
s and AbstractStrings
for indexing according to what's most appropriate for the problem at hand, while still supporting all kinds of table types.