Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: allow column access by AbstractString #328

Open
simsurace opened this issue Feb 22, 2023 · 0 comments
Open

RFC: allow column access by AbstractString #328

simsurace opened this issue Feb 22, 2023 · 0 comments

Comments

@simsurace
Copy link

Tables.jl currently supports column access by Integers and Symbols. Many implementations use Symbols to keep track of column names, such as DataFrames.Index. However, generating too many unique Symbols can lead to memory leaks because Symbols are not garbage collected.
This calls for implementations which use something else, such as Strings or InlineStrings.

Could we add indexing by AbstractStrings 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 Symbols.

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 Symbols and AbstractStrings for indexing according to what's most appropriate for the problem at hand, while still supporting all kinds of table types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant