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

Strongly Typed Array Slicing #3929

Closed
tustvold opened this issue Mar 24, 2023 · 1 comment · Fixed by #3930
Closed

Strongly Typed Array Slicing #3929

tustvold opened this issue Mar 24, 2023 · 1 comment · Fixed by #3930
Labels
arrow Changes to the arrow crate enhancement Any new improvement worthy of a entry in the changelog parquet Changes to the parquet crate

Comments

@tustvold
Copy link
Contributor

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

Currently calling Array::slice returns an ArrayRef, even if calling on a strongly typed array. This results in a lot of code of the form

let a = Int32Array::from(vec![Some(15), None, Some(9), Some(8), None]);
let a = a.slice(1, 4);
let a = a.as_primitive();

This is not only verbose but has potential performance implications.

Describe the solution you'd like

Arrays should provide Array::slice(&self, offset: usize, len: usize) -> Self

Describe alternatives you've considered

Additional context

Part of #3880

@tustvold tustvold added the enhancement Any new improvement worthy of a entry in the changelog label Mar 24, 2023
tustvold added a commit to tustvold/arrow-rs that referenced this issue Mar 24, 2023
tustvold added a commit to tustvold/arrow-rs that referenced this issue Mar 24, 2023
tustvold added a commit to tustvold/arrow-rs that referenced this issue Mar 24, 2023
tustvold added a commit that referenced this issue Mar 28, 2023
* Add PrimitiveArray slice (#3880)

* Add ByteArray::slice (#3929)

* Add strongly typed Array::slice (#3929)
@tustvold tustvold added the arrow Changes to the arrow crate label Mar 30, 2023
@tustvold tustvold added the parquet Changes to the parquet crate label Apr 7, 2023
@tustvold
Copy link
Contributor Author

tustvold commented Apr 7, 2023

label_issue.py automatically added labels {'parquet'} from #3930

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 parquet Changes to the parquet crate
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant