diff --git a/arrow-array/src/array/fixed_size_binary_array.rs b/arrow-array/src/array/fixed_size_binary_array.rs index 74a7c4c7a84a..f0b04c203ceb 100644 --- a/arrow-array/src/array/fixed_size_binary_array.rs +++ b/arrow-array/src/array/fixed_size_binary_array.rs @@ -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. diff --git a/arrow-string/src/substring.rs b/arrow-string/src/substring.rs index 1075d106911e..dc0dfdcbb4ad 100644 --- a/arrow-string/src/substring.rs +++ b/arrow-string/src/substring.rs @@ -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| {