diff --git a/crates/polars-arrow/src/bitmap/immutable.rs b/crates/polars-arrow/src/bitmap/immutable.rs index c8ce3ca12f26..24e5778bf5cb 100644 --- a/crates/polars-arrow/src/bitmap/immutable.rs +++ b/crates/polars-arrow/src/bitmap/immutable.rs @@ -410,15 +410,15 @@ impl Bitmap { }); let zero_bytes = rwlock_zero_bytes.upgradable_read(); - let bytes = if zero_bytes.len() * 8 < length { + let bytes = if zero_bytes.len() * 8 >= length { + zero_bytes.clone() + } else { let bytes = Arc::new(Bytes::from(vec![0; length.div_ceil(8)])); let mut zero_bytes = RwLockUpgradableReadGuard::upgrade(zero_bytes); *zero_bytes = bytes.clone(); bytes - } else { - zero_bytes.clone() }; Bitmap { diff --git a/crates/polars-utils/src/foreign_vec.rs b/crates/polars-utils/src/foreign_vec.rs index 9ab1ddbb34ef..f763246ec029 100644 --- a/crates/polars-utils/src/foreign_vec.rs +++ b/crates/polars-utils/src/foreign_vec.rs @@ -1,5 +1,4 @@ /// This is pulled out of https://github.com/DataEngineeringLabs/foreign_vec - use std::mem::ManuallyDrop; use std::ops::DerefMut; use std::vec::Vec; @@ -66,11 +65,11 @@ impl Drop for ForeignVec { match self.allocation { Allocation::Foreign(_) => { // the foreign is dropped via its `Drop` - } + }, Allocation::Native => { let data = core::mem::take(&mut self.data); let _ = ManuallyDrop::into_inner(data); - } + }, } } }