From 01f00aad6f1194d976d9a817a6a864ffbba28db4 Mon Sep 17 00:00:00 2001 From: Pxl Date: Mon, 15 Jul 2024 21:20:33 +0800 Subject: [PATCH] [Bug](bitmap) clear set when bitmap fastunion (#37816) ## Proposed changes before:6 min 59.33 sec after :24.67 sec --- be/src/util/bitmap_value.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/be/src/util/bitmap_value.h b/be/src/util/bitmap_value.h index ac5e826e1fee66..2d15ac99611274 100644 --- a/be/src/util/bitmap_value.h +++ b/be/src/util/bitmap_value.h @@ -1252,8 +1252,7 @@ class BitmapValue { std::vector bitmaps; std::vector single_values; std::vector*> sets; - for (int i = 0; i < values.size(); ++i) { - auto* value = values[i]; + for (const auto* value : values) { switch (value->_type) { case EMPTY: break; @@ -1280,7 +1279,9 @@ class BitmapValue { _bitmap->add(_sv); break; case BITMAP: - *_bitmap |= detail::Roaring64Map::fastunion(bitmaps.size(), bitmaps.data()); + for (const auto* bitmap : bitmaps) { + *_bitmap |= *bitmap; + } break; case SET: { *_bitmap = detail::Roaring64Map::fastunion(bitmaps.size(), bitmaps.data()); @@ -1315,6 +1316,7 @@ class BitmapValue { _bitmap->add(v); } _type = BITMAP; + _set.clear(); break; case SET: { break;