use of org.roaringbitmap.RoaringBitmap in project Gaffer by gchq.
the class RoaringBitmapAggregatorTest method shouldCloneInputBitmapWhenAggregating.
@Test
public void shouldCloneInputBitmapWhenAggregating() {
// Given
final RoaringBitmapAggregator roaringBitmapAggregator = new RoaringBitmapAggregator();
roaringBitmapAggregator.init();
final RoaringBitmap bitmap = mock(RoaringBitmap.class);
final RoaringBitmap clonedBitmap = mock(RoaringBitmap.class);
given(bitmap.clone()).willReturn(clonedBitmap);
// When
roaringBitmapAggregator._aggregate(bitmap);
// Then
assertSame(clonedBitmap, roaringBitmapAggregator.state()[0]);
assertNotSame(bitmap, roaringBitmapAggregator.state()[0]);
}
use of org.roaringbitmap.RoaringBitmap in project carbondata by apache.
the class FilterUtil method prepareExcludeFilterMembers.
private static List<Integer> prepareExcludeFilterMembers(Dictionary forwardDictionary, List<Integer> includeSurrogates) throws FilterUnsupportedException {
DictionaryChunksWrapper dictionaryWrapper;
RoaringBitmap bitMapOfSurrogates = RoaringBitmap.bitmapOf(ArrayUtils.toPrimitive(includeSurrogates.toArray(new Integer[includeSurrogates.size()])));
dictionaryWrapper = forwardDictionary.getDictionaryChunks();
List<Integer> excludeFilterList = new ArrayList<Integer>(includeSurrogates.size());
int surrogateCount = 0;
while (dictionaryWrapper.hasNext()) {
dictionaryWrapper.next();
++surrogateCount;
if (!bitMapOfSurrogates.contains(surrogateCount)) {
excludeFilterList.add(surrogateCount);
}
}
return excludeFilterList;
}
use of org.roaringbitmap.RoaringBitmap in project RoaringBitmap by RoaringBitmap.
the class RunContainerRealDataBenchmarkRunOptimize method serializeToBAOSFromClonePreOpti.
@Benchmark
public int serializeToBAOSFromClonePreOpti(BenchmarkState benchmarkState) throws IOException {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(bos);
for (int i = 0; i < benchmarkState.rc.size(); i++) {
RoaringBitmap bitmap = benchmarkState.rc.get(i).clone();
bitmap.serialize(dos);
}
dos.flush();
return bos.size();
}
use of org.roaringbitmap.RoaringBitmap in project RoaringBitmap by RoaringBitmap.
the class RunContainerRealDataBenchmarkRunOptimize method cloneAndrunOptimize.
@Benchmark
public int cloneAndrunOptimize(BenchmarkState benchmarkState) {
int total = 0;
for (int i = 0; i < benchmarkState.ac.size(); i++) {
RoaringBitmap bitmap = benchmarkState.ac.get(i).clone();
bitmap.runOptimize();
total += bitmap.getCardinality();
}
return total;
}
use of org.roaringbitmap.RoaringBitmap in project RoaringBitmap by RoaringBitmap.
the class RunContainerRealDataBenchmarkRunOptimize method serializeToBAOSFromClone.
@Benchmark
public int serializeToBAOSFromClone(BenchmarkState benchmarkState) throws IOException {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(bos);
for (int i = 0; i < benchmarkState.ac.size(); i++) {
RoaringBitmap bitmap = benchmarkState.ac.get(i).clone();
bitmap.serialize(dos);
}
dos.flush();
return bos.size();
}
Aggregations