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

Bug in roaring_bitmap_from_range followed by roaring_bitmap_add_offset

Ezibenroc opened this issue · comments

The following code shows a bug:

  roaring_bitmap_t *r1 = roaring_bitmap_from_range(65539, 65541, 1);
  roaring_bitmap_t *r2 = roaring_bitmap_add_offset(r1, -3);
  roaring_bitmap_printf(r2);
  roaring_bitmap_free(r1);
  roaring_bitmap_free(r2);

I was expecting to see {65536,65537}, instead we see {0,1,2,...,65536,65537}. It seems this bug has always been here.

From my tests:

  • It happens only when the bitmap is created with roaring_bitmap_from_range. In this case, it has a single run container.
  • It happens for these specific values. The bug is not present when changing the offset or changing the range.

Hmmm... On my TODO. Thanks for the report.