RoaringBitmap / CRoaring

Roaring bitmaps in C (and C++), with SIMD (AVX2, AVX-512 and NEON) optimizations: used by Apache Doris, ClickHouse, and StarRocks

Home Page:http://roaringbitmap.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

roaring64: large `add_range_closed` leads to incorrect cardinality

Dr-Emann opened this issue · comments

Reproduction:

roaring64_bitmap_t* r = roaring64_bitmap_create();
uint64_t end = 16842837;
uint64_t start = 22;
roaring64_bitmap_add_range_closed(r, start, end);
assert_int_equal(roaring64_bitmap_get_cardinality(r), end - start + 1);
roaring64_bitmap_free(r);

Result:
0x100ffea != 0x1010040 (reported cardinality is 86 (0x56) less than it should be)

Hmm, using start = 0, end = 0x1010000 seems to be the first error (off by only one), end=100FFFF reports the correct cardinality.

end = 0x100FFFF, end = 0x1010000, end = 0x1010001, end = 0x1010002, end = 0x101FFFF all report cardinality as 0x1010000, it seems like a whole container is going missing.