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

More ergonomic / idiomatic primitive array creation from iterators #1298

Closed
alamb opened this issue Feb 10, 2022 · 0 comments · Fixed by #1367
Closed

More ergonomic / idiomatic primitive array creation from iterators #1298

alamb opened this issue Feb 10, 2022 · 0 comments · Fixed by #1367
Labels
arrow Changes to the arrow crate enhancement Any new improvement worthy of a entry in the changelog help wanted

Comments

@alamb
Copy link
Contributor

alamb commented Feb 10, 2022

Is your feature request related to a problem or challenge? Please describe what you are trying to do.

I want to write this to create an array without nulls (as I am used to using this syntax all over rust codebases):

let value_data: Int8Array = [10_i8, 11, 12, 13, 14, 15, 16, 17]
  .into_iter()
  .collect();

However, i have to write this (add a Some so it becomes an Option) which is annoying.

let value_data: Int8Array = [10_i8, 11, 12, 13, 14, 15, 16, 17]
  .into_iter()
  .map(Some)
  .collect();

Note you can write this, but that is not as idomatic

        let value_data = Int8Array::from_iter_values([10_i8, 11, 12, 13, 14, 15, 16, 17]);

Describe the solution you'd like
But it would be more ergonomic to be able to just use the collect syntax

Namely I want to write this and have it work:

let value_data: Int8Array = [10_i8, 11, 12, 13, 14, 15, 16, 17]
  .into_iter()
  .collect();

Also, for BooleanArray and StringArray

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

Additional context

@alamb alamb added enhancement Any new improvement worthy of a entry in the changelog help wanted labels Feb 10, 2022
@alamb alamb added the arrow Changes to the arrow crate label Mar 3, 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 help wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant