From 3d06e13529e0d97840ba6b8b60792cd0057d0ff6 Mon Sep 17 00:00:00 2001 From: Will Manning Date: Tue, 27 Feb 2024 18:05:17 -0500 Subject: [PATCH] call shrink_to_fit() on roaring bitmaps (#27) * bitmap shrink_to_fit * one more --- vortex-roaring/src/boolean/compress.rs | 1 + vortex-roaring/src/integer/compress.rs | 1 + 2 files changed, 2 insertions(+) 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) }