diff --git a/vortex-roaring/src/boolean/compress.rs b/vortex-roaring/src/boolean/compress.rs index de2d8b334a..87c76f62e9 100644 --- a/vortex-roaring/src/boolean/compress.rs +++ b/vortex-roaring/src/boolean/compress.rs @@ -48,6 +48,7 @@ pub fn roaring_encode(bool_array: &BoolArray) -> RoaringBoolArray { .map(|(i, _)| i as u32), ); bitmap.run_optimize(); + bitmap.shrink_to_fit(); RoaringBoolArray::new(bitmap, bool_array.buffer().len()) } diff --git a/vortex-roaring/src/integer/compress.rs b/vortex-roaring/src/integer/compress.rs index 01f28a07e3..2104108dd7 100644 --- a/vortex-roaring/src/integer/compress.rs +++ b/vortex-roaring/src/integer/compress.rs @@ -73,5 +73,6 @@ fn roaring_encode_primitive(values: &[T]) -> RoaringIn let mut bitmap = Bitmap::new(); bitmap.extend(values.iter().map(|i| i.to_u32().unwrap())); bitmap.run_optimize(); + bitmap.shrink_to_fit(); RoaringIntArray::new(bitmap, T::PTYPE) }