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

Add DictionaryArray::key function #1911

Closed
alamb opened this issue Jun 19, 2022 · 0 comments · Fixed by #1912
Closed

Add DictionaryArray::key function #1911

alamb opened this issue Jun 19, 2022 · 0 comments · Fixed by #1912
Labels
arrow Changes to the arrow crate enhancement Any new improvement worthy of a entry in the changelog

Comments

@alamb
Copy link
Contributor

alamb commented Jun 19, 2022

Is your feature request related to a problem or challenge? Please describe what you are trying to do.
I want to write code to fetch the value of a dictionary array regardless of the type of its key (like apache/datafusion#2721 (comment))

This is definitely possible but it is somewhat awkward today and requires calling to_usize and asserting that that was a valid usize

A way to get the key as usize would make the API easier to use I think -- see
https://github.com/apache/arrow-datafusion/blob/080c32400ddfa2d45b5bebb820184eac8fd5a03a/datafusion/common/src/scalar.rs#L342-L358

for how it has to be done today

Describe the solution you'd like
I would like a way to get the key at index i as a usize

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

@alamb alamb added the enhancement Any new improvement worthy of a entry in the changelog label Jun 19, 2022
@alamb alamb added the arrow Changes to the arrow crate label Jun 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate enhancement Any new improvement worthy of a entry in the changelog
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant