From 161c4730cfb8e07503a0b663b2ce89017a3b29a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Horstmann?= Date: Fri, 1 Jan 2021 13:11:47 +0100 Subject: [PATCH] ARROW-11099 Remove unsafe value_slice and raw_values methods from primitive and boolean arrays --- rust/arrow/src/array/array_boolean.rs | 14 -------------- rust/arrow/src/array/array_primitive.rs | 13 ------------- 2 files changed, 27 deletions(-) diff --git a/rust/arrow/src/array/array_boolean.rs b/rust/arrow/src/array/array_boolean.rs index ae39dd151dd..4f029aa5f20 100644 --- a/rust/arrow/src/array/array_boolean.rs +++ b/rust/arrow/src/array/array_boolean.rs @@ -55,20 +55,6 @@ impl BooleanArray { self.data.is_empty() } - /// Returns a raw pointer to the values of this array. - pub fn raw_values(&self) -> *const u8 { - unsafe { self.raw_values.as_ptr().add(self.data.offset()) } - } - - /// Returns a slice for the given offset and length - /// - /// Note this doesn't do any bound checking, for performance reason. - pub fn value_slice(&self, offset: usize, len: usize) -> &[u8] { - let raw = - unsafe { std::slice::from_raw_parts(self.raw_values().add(offset), len) }; - &raw[..] - } - // Returns a new boolean array builder pub fn builder(capacity: usize) -> BooleanBuilder { BooleanBuilder::new(capacity) diff --git a/rust/arrow/src/array/array_primitive.rs b/rust/arrow/src/array/array_primitive.rs index 03001fe6b4c..e756995695a 100644 --- a/rust/arrow/src/array/array_primitive.rs +++ b/rust/arrow/src/array/array_primitive.rs @@ -66,19 +66,6 @@ impl PrimitiveArray { self.data.is_empty() } - /// Returns a slice for the given offset and length - /// - /// Note this doesn't do any bound checking, for performance reason. - /// # Safety - /// caller must ensure that the passed in offset + len are less than the array len() - #[deprecated(note = "Please use values() instead")] - pub unsafe fn value_slice(&self, offset: usize, len: usize) -> &[T::Native] { - std::slice::from_raw_parts( - self.raw_values.as_ptr().add(self.data.offset()).add(offset), - len, - ) - } - /// Returns a slice of the values of this array #[inline] pub fn values(&self) -> &[T::Native] {