Search in sources :

Example 21 with ColumnHolder

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

the class QueryableIndexStorageAdapter method populateMinMaxTime.

private void populateMinMaxTime() {
    // Compute and cache minTime, maxTime.
    final ColumnHolder columnHolder = index.getColumnHolder(ColumnHolder.TIME_COLUMN_NAME);
    try (final NumericColumn column = (NumericColumn) columnHolder.getColumn()) {
        this.minTime = DateTimes.utc(column.getLongSingleValueRow(0));
        this.maxTime = DateTimes.utc(column.getLongSingleValueRow(column.length() - 1));
    }
}
Also used : ColumnHolder(org.apache.druid.segment.column.ColumnHolder) NumericColumn(org.apache.druid.segment.column.NumericColumn)

Example 22 with ColumnHolder

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

the class QueryableIndexIndexableAdapter method getBitmapIndex.

@VisibleForTesting
BitmapValues getBitmapIndex(String dimension, String value) {
    final ColumnHolder columnHolder = input.getColumnHolder(dimension);
    if (columnHolder == null) {
        return BitmapValues.EMPTY;
    }
    final BitmapIndex bitmaps = columnHolder.getBitmapIndex();
    if (bitmaps == null) {
        return BitmapValues.EMPTY;
    }
    return new ImmutableBitmapValues(bitmaps.getBitmap(bitmaps.getIndex(value)));
}
Also used : ColumnHolder(org.apache.druid.segment.column.ColumnHolder) BitmapIndex(org.apache.druid.segment.column.BitmapIndex) ImmutableBitmapValues(org.apache.druid.segment.data.ImmutableBitmapValues) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Example 23 with ColumnHolder

use of org.apache.druid.segment.column.ColumnHolder 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

ColumnHolder (org.apache.druid.segment.column.ColumnHolder)23 BitmapIndex (org.apache.druid.segment.column.BitmapIndex)10 Nullable (javax.annotation.Nullable)7 ColumnCapabilities (org.apache.druid.segment.column.ColumnCapabilities)7 ImmutableBitmap (org.apache.druid.collections.bitmap.ImmutableBitmap)6 DictionaryEncodedColumn (org.apache.druid.segment.column.DictionaryEncodedColumn)6 BitmapFactory (org.apache.druid.collections.bitmap.BitmapFactory)5 File (java.io.File)4 HashMap (java.util.HashMap)4 Map (java.util.Map)4 ISE (org.apache.druid.java.util.common.ISE)4 QueryableIndex (org.apache.druid.segment.QueryableIndex)4 BaseColumn (org.apache.druid.segment.column.BaseColumn)4 Test (org.junit.Test)4 RoaringBitmapFactory (org.apache.druid.collections.bitmap.RoaringBitmapFactory)3 RuntimeShapeInspector (org.apache.druid.query.monomorphicprocessing.RuntimeShapeInspector)3 VisibleForTesting (com.google.common.annotations.VisibleForTesting)2 ImmutableList (com.google.common.collect.ImmutableList)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2