cambyzju commented on code in PR #19973: URL: https://github.com/apache/doris/pull/19973#discussion_r1205124041
########## be/src/util/bitmap_value.h: ########## @@ -1959,16 +2511,31 @@ class BitmapValue { _is_shared = false; } + void _convert_to_bitmap_if_need() { + if (_type != SET || _set.size() <= SET_TYPE_THRESHOLD) { + return; + } + _prepare_bitmap_for_write(); + for (auto v : _set) { + _bitmap->add(v); + } + _type = BITMAP; + _set.clear(); + } + enum BitmapDataType { EMPTY = 0, SINGLE = 1, // single element - BITMAP = 2 // more than one elements + SET = 2, // elements count less or equal than 32 + BITMAP = 3 // more than one elements }; uint64_t _sv = 0; // store the single value when _type == SINGLE std::shared_ptr<detail::Roaring64Map> _bitmap; // used when _type == BITMAP + phmap::flat_hash_set<uint64_t> _set; BitmapDataType _type {EMPTY}; // Indicate whether the state is shared among multi BitmapValue object bool _is_shared = true; + static constexpr uint64_t SET_TYPE_THRESHOLD = 32; Review Comment: why `SET_TYPE_THRESHOLD == 32` ? Is there any performance test reports? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org