use of org.apache.druid.collections.bitmap.MutableBitmap in project druid by druid-io.
the class IncrementalIndexAdapter method getBitmapValues.
@Override
public BitmapValues getBitmapValues(String dimension, int index) {
DimensionAccessor accessor = accessors.get(dimension);
if (accessor == null) {
return BitmapValues.EMPTY;
}
ColumnCapabilities capabilities = accessor.dimensionDesc.getCapabilities();
DimensionIndexer indexer = accessor.dimensionDesc.getIndexer();
if (!capabilities.hasBitmapIndexes()) {
return BitmapValues.EMPTY;
}
final int id = (Integer) indexer.getUnsortedEncodedValueFromSorted(index);
if (id < 0 || id >= indexer.getCardinality()) {
return BitmapValues.EMPTY;
}
MutableBitmap bitmapIndex = accessor.invertedIndexes[id];
if (bitmapIndex == null) {
return BitmapValues.EMPTY;
}
return new MutableBitmapValues(bitmapIndex);
}
use of org.apache.druid.collections.bitmap.MutableBitmap in project druid by druid-io.
the class BitmapCreationBenchmark method testLinearAdditionDescending.
@BenchmarkOptions(warmupRounds = 10, benchmarkRounds = 1000)
@Test
public void testLinearAdditionDescending() {
MutableBitmap mutableBitmap = factory.makeEmptyMutableBitmap();
for (int i = NUM_BITS - 1; i >= 0; --i) {
mutableBitmap.add(i);
}
Assert.assertEquals(NUM_BITS, mutableBitmap.size());
}
use of org.apache.druid.collections.bitmap.MutableBitmap in project druid by druid-io.
the class BitmapCreationBenchmark method testRandomAddition.
@BenchmarkOptions(warmupRounds = 10, benchmarkRounds = 10)
@Test
public void testRandomAddition() {
MutableBitmap mutableBitmap = factory.makeEmptyMutableBitmap();
for (int i : randIndex) {
mutableBitmap.add(i);
}
Assert.assertEquals(NUM_BITS, mutableBitmap.size());
}
Aggregations