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

feat: FixedSizeBinaryArray::value_data return reference #4821

Merged
merged 2 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions arrow-array/src/array/fixed_size_binary_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,18 @@ impl FixedSizeBinaryArray {
self.value_length
}

/// Returns a clone of the value data buffer
pub fn value_data(&self) -> Buffer {
self.value_data.clone()
/// Returns the values of this array.
///
/// Unlike [`Self::value_data`] this returns the [`Buffer`]
/// allowing for zero-copy cloning.
#[inline]
pub fn values(&self) -> &Buffer {
&self.value_data
}

/// Returns the raw value data.
pub fn value_data(&self) -> &[u8] {
self.value_data.as_slice()
}

/// Returns a zero-copy slice of this array with the indicated offset and length.
Expand Down
3 changes: 1 addition & 2 deletions arrow-string/src/substring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,7 @@ fn fixed_size_binary_substring(

// build value buffer
let num_of_elements = array.len();
let values = array.value_data();
let data = values.as_slice();
let data = array.value_data();
let mut new_values = MutableBuffer::new(num_of_elements * (new_len as usize));
(0..num_of_elements)
.map(|idx| {
Expand Down
Loading