Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Changed methods to slice arrays #1396

Merged
merged 3 commits into from
Feb 12, 2023
Merged

Changed methods to slice arrays #1396

merged 3 commits into from
Feb 12, 2023

Conversation

jorgecarleitao
Copy link
Owner

Currently slicing arrays require cloning. This PR removes that requirement.

Backward incompatible changes

  • slice(&self, offset: usize, length: usize) -> Self in all arrays and trait Array changed signature to slice(&mut self, offset: usize, length: usize)
  • New function sliced(self, offset: usize, length: usize) -> Self was added to all arrays
  • New function sliced(&self, offset: usize, length: usize) -> Box<dyn Array> was added to Array trait

With this new API:

  • slice an &mut array in place via array.slice(...)
  • slice an array via let array = array.sliced(...);
  • slice an &array by cloning it and using array

@codecov
Copy link

codecov bot commented Feb 12, 2023

Codecov Report

Base: 83.49% // Head: 83.44% // Decreases project coverage by -0.05% ⚠️

Coverage data is based on head (359c170) compared to base (7be484e).
Patch coverage: 82.38% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1396      +/-   ##
==========================================
- Coverage   83.49%   83.44%   -0.05%     
==========================================
  Files         373      373              
  Lines       40758    40721      -37     
==========================================
- Hits        34029    33980      -49     
- Misses       6729     6741      +12     
Impacted Files Coverage Δ
src/array/union/ffi.rs 0.00% <0.00%> (ø)
src/array/null.rs 54.66% <14.28%> (+2.10%) ⬆️
src/offset.rs 83.21% <20.00%> (-2.40%) ⬇️
src/array/map/mod.rs 54.28% <41.66%> (-6.94%) ⬇️
src/array/union/mod.rs 82.57% <50.00%> (-2.05%) ⬇️
src/array/equal/struct_.rs 70.73% <66.66%> (+24.39%) ⬆️
src/array/fixed_size_binary/mod.rs 85.95% <81.81%> (+0.92%) ⬆️
src/buffer/immutable.rs 84.61% <83.33%> (-5.63%) ⬇️
src/array/fixed_size_list/mod.rs 84.82% <84.61%> (-0.89%) ⬇️
src/bitmap/immutable.rs 84.88% <88.88%> (-1.18%) ⬇️
... and 34 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@jorgecarleitao jorgecarleitao merged commit d7d7239 into main Feb 12, 2023
@jorgecarleitao jorgecarleitao deleted the slice1 branch February 12, 2023 18:14
ritchie46 pushed a commit to ritchie46/arrow2 that referenced this pull request Mar 29, 2023
ritchie46 pushed a commit to ritchie46/arrow2 that referenced this pull request Apr 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant