RoaringBitmap: Roaring64Bitmap.removeLong results in a NegativeArraySizeException
Describe the bug I am trying to build a funnel for a tracking system where an event can transition to multiple states. After an event has moved to a new state(B from A), I will want to remove it from calc of state A
While calling roaringBitmap.removeLong(trackId);, I am getting the following exception
Caused by: java.lang.NegativeArraySizeException
at org.roaringbitmap.art.Node4.remove(Node4.java:124)
at org.roaringbitmap.art.Art.removeSpecifyKey(Art.java:144)
at org.roaringbitmap.art.Art.remove(Art.java:104)
at org.roaringbitmap.longlong.HighLowContainer.remove(HighLowContainer.java:63)
at org.roaringbitmap.longlong.Roaring64Bitmap.removeLong(Roaring64Bitmap.java:752)
at flinkcommonjobs.helpers.FunnelCustomProcess.process(FunnelCustomProcess.java:107)
Plot of count emitted by the bitmap, as you can see I am not getting the above exception everytime

trackId are generated in a random order.
Should I call runOptimize before removing the Id?
To Reproduce My code snippet
Roaring64Bitmap roaringBitmap = distinctCountState.get(eventKey);
if (!roaringBitmap.isEmpty()) {
roaringBitmap.removeLong(trackId);
distinctCountState.put(eventKey, roaringBitmap);
}
RoaringBitmap version: 0.9.26 https://mvnrepository.com/artifact/org.roaringbitmap/RoaringBitmap/0.9.26 Java version: openjdk version “1.8.0_312”
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 18 (13 by maintainers)
We will be happy to receive a reproducible bug report.
As @weijietong correctly explained, just capture the state of the bitmap and the value of the key being removed. Then verify that you can isolate and reproduce the issue. We will happily investigate and fix it… but we need a reproducible single-threaded case.
@ayush-san please try to use the latest version to verify your case.We have fixed a empty() bug after your using version.And the given reproduced codes by you is not runnable to reproduce the bug.