Search in sources :

Example 21 with BitmapIndex

use of org.apache.druid.segment.column.BitmapIndex in project druid by druid-io.

the class QueryableIndexIndexableAdapter method getBitmapValues.

@Override
public BitmapValues getBitmapValues(String dimension, int dictId) {
    final ColumnHolder columnHolder = input.getColumnHolder(dimension);
    if (columnHolder == null) {
        return BitmapValues.EMPTY;
    }
    final BitmapIndex bitmaps = columnHolder.getBitmapIndex();
    if (bitmaps == null) {
        return BitmapValues.EMPTY;
    }
    if (dictId >= 0) {
        return new ImmutableBitmapValues(bitmaps.getBitmap(dictId));
    } else {
        return BitmapValues.EMPTY;
    }
}
Also used : ColumnHolder(org.apache.druid.segment.column.ColumnHolder) BitmapIndex(org.apache.druid.segment.column.BitmapIndex) ImmutableBitmapValues(org.apache.druid.segment.data.ImmutableBitmapValues)

Aggregations

BitmapIndex (org.apache.druid.segment.column.BitmapIndex)21 ColumnHolder (org.apache.druid.segment.column.ColumnHolder)10 ImmutableBitmap (org.apache.druid.collections.bitmap.ImmutableBitmap)9 BitmapFactory (org.apache.druid.collections.bitmap.BitmapFactory)8 RoaringBitmapFactory (org.apache.druid.collections.bitmap.RoaringBitmapFactory)6 Test (org.junit.Test)6 IOException (java.io.IOException)4 MutableBitmap (org.apache.druid.collections.bitmap.MutableBitmap)4 BitmapSerdeFactory (org.apache.druid.segment.data.BitmapSerdeFactory)4 RoaringBitmapSerdeFactory (org.apache.druid.segment.data.RoaringBitmapSerdeFactory)4 Function (com.google.common.base.Function)3 StringBitmapIndexColumnPartSupplier (org.apache.druid.segment.serde.StringBitmapIndexColumnPartSupplier)3 InitializedNullHandlingTest (org.apache.druid.testing.InitializedNullHandlingTest)3 Setup (org.openjdk.jmh.annotations.Setup)3 UncheckedIOException (java.io.UncheckedIOException)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Nullable (javax.annotation.Nullable)2 ConciseBitmapFactory (org.apache.druid.collections.bitmap.ConciseBitmapFactory)2 DefaultDimensionSpec (org.apache.druid.query.dimension.DefaultDimensionSpec)2