Search in sources :

Example 6 with Indexed

use of io.druid.segment.data.Indexed in project druid by druid-io.

the class ColumnSelectorBitmapIndexSelector method getDimensionValues.

@Override
public Indexed<String> getDimensionValues(String dimension) {
    if (isFilterableVirtualColumn(dimension)) {
        // Virtual columns don't have dictionaries or indexes.
        return null;
    }
    final Column columnDesc = index.getColumn(dimension);
    if (columnDesc == null || !columnDesc.getCapabilities().isDictionaryEncoded()) {
        return null;
    }
    final DictionaryEncodedColumn<String> column = columnDesc.getDictionaryEncoding();
    return new Indexed<String>() {

        @Override
        public Class<? extends String> getClazz() {
            return String.class;
        }

        @Override
        public int size() {
            return column.getCardinality();
        }

        @Override
        public String get(int index) {
            return column.lookupName(index);
        }

        @Override
        public int indexOf(String value) {
            return column.lookupId(value);
        }

        @Override
        public Iterator<String> iterator() {
            return IndexedIterable.create(this).iterator();
        }
    };
}
Also used : GenericColumn(io.druid.segment.column.GenericColumn) Column(io.druid.segment.column.Column) DictionaryEncodedColumn(io.druid.segment.column.DictionaryEncodedColumn) Indexed(io.druid.segment.data.Indexed)

Aggregations

Indexed (io.druid.segment.data.Indexed)6 GenericIndexed (io.druid.segment.data.GenericIndexed)4 Function (com.google.common.base.Function)3 BitmapFactory (io.druid.collections.bitmap.BitmapFactory)3 ImmutableBitmap (io.druid.collections.bitmap.ImmutableBitmap)3 MutableBitmap (io.druid.collections.bitmap.MutableBitmap)3 RoaringBitmapFactory (io.druid.collections.bitmap.RoaringBitmapFactory)3 ImmutableRTree (io.druid.collections.spatial.ImmutableRTree)3 BitmapIndexSelector (io.druid.query.filter.BitmapIndexSelector)3 BitmapIndex (io.druid.segment.column.BitmapIndex)3 BitmapSerdeFactory (io.druid.segment.data.BitmapSerdeFactory)3 RoaringBitmapSerdeFactory (io.druid.segment.data.RoaringBitmapSerdeFactory)3 BitmapIndexColumnPartSupplier (io.druid.segment.serde.BitmapIndexColumnPartSupplier)3 Setup (org.openjdk.jmh.annotations.Setup)3 Column (io.druid.segment.column.Column)2 DictionaryEncodedColumn (io.druid.segment.column.DictionaryEncodedColumn)2 GenericColumn (io.druid.segment.column.GenericColumn)2 ListIndexed (io.druid.segment.data.ListIndexed)2 ComplexColumn (io.druid.segment.column.ComplexColumn)1 IndexedFloatsGenericColumn (io.druid.segment.column.IndexedFloatsGenericColumn)1