Search in sources :

Example 1 with IdMapping

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

the class ListFilteredVirtualColumn method getBitmapIndex.

@Override
@Nullable
public BitmapIndex getBitmapIndex(String columnName, ColumnSelector selector) {
    final ColumnHolder holder = selector.getColumnHolder(delegate.getDimension());
    if (holder == null) {
        return null;
    }
    final BitmapIndex underlyingIndex = holder.getBitmapIndex();
    if (underlyingIndex == null) {
        return null;
    }
    final IdMapping idMapping;
    if (allowList) {
        idMapping = ListFilteredDimensionSpec.buildAllowListIdMapping(values, underlyingIndex.getCardinality(), null, underlyingIndex::getValue);
    } else {
        idMapping = ListFilteredDimensionSpec.buildDenyListIdMapping(values, underlyingIndex.getCardinality(), underlyingIndex::getValue);
    }
    return new ListFilteredBitmapIndex(underlyingIndex, idMapping);
}
Also used : ColumnHolder(org.apache.druid.segment.column.ColumnHolder) BitmapIndex(org.apache.druid.segment.column.BitmapIndex) IdMapping(org.apache.druid.segment.IdMapping) Nullable(javax.annotation.Nullable)

Aggregations

Nullable (javax.annotation.Nullable)1 IdMapping (org.apache.druid.segment.IdMapping)1 BitmapIndex (org.apache.druid.segment.column.BitmapIndex)1 ColumnHolder (org.apache.druid.segment.column.ColumnHolder)1