diff --git a/src/array/mod.rs b/src/array/mod.rs index bbbbedc359..04b7b2c8e3 100644 --- a/src/array/mod.rs +++ b/src/array/mod.rs @@ -73,9 +73,18 @@ pub trait Array: Send + Sync + dyn_clone::DynClone + 'static { /// Panics iff `i >= self.len()`. #[inline] fn is_null(&self, i: usize) -> bool { + assert!(i < self.len()); + unsafe { self.is_null_unchecked(i) } + } + + /// Returns whether slot `i` is null. + /// # Safety + /// The caller must ensure `i < self.len()` + #[inline] + unsafe fn is_null_unchecked(&self, i: usize) -> bool { self.validity() .as_ref() - .map(|x| !x.get_bit(i)) + .map(|x| !x.get_bit_unchecked(i)) .unwrap_or(false) } diff --git a/src/io/ipc/read/file.rs b/src/io/ipc/read/file.rs index dd4a5852c7..e95b37e44d 100644 --- a/src/io/ipc/read/file.rs +++ b/src/io/ipc/read/file.rs @@ -216,7 +216,7 @@ pub fn read_file_metadata(reader: &mut R) -> Result