use of io.druid.segment.column.BitmapIndex in project druid by druid-io.
the class FiltersTest method makeNonOverlappedBitmapIndexes.
private static BitmapIndex makeNonOverlappedBitmapIndexes(final int bitmapNum, final List<ImmutableBitmap> bitmaps) {
final BitmapIndex bitmapIndex = getBitmapIndex(bitmaps);
final BitmapFactory factory = bitmapIndex.getBitmapFactory();
for (int i = 0; i < bitmapNum; i++) {
final MutableBitmap mutableBitmap = factory.makeEmptyMutableBitmap();
for (int j = 0; j < 10; j++) {
mutableBitmap.add(i * 10 + j);
}
bitmaps.add(factory.makeImmutableBitmap(mutableBitmap));
}
return bitmapIndex;
}
use of io.druid.segment.column.BitmapIndex in project druid by druid-io.
the class SegmentAnalyzer method analyzeStringColumn.
private ColumnAnalysis analyzeStringColumn(final ColumnCapabilities capabilities, final Column column) {
long size = 0;
Comparable min = null;
Comparable max = null;
if (!capabilities.hasBitmapIndexes()) {
return ColumnAnalysis.error("string_no_bitmap");
}
final BitmapIndex bitmapIndex = column.getBitmapIndex();
final int cardinality = bitmapIndex.getCardinality();
if (analyzingSize()) {
for (int i = 0; i < cardinality; ++i) {
String value = bitmapIndex.getValue(i);
if (value != null) {
size += StringUtils.estimatedBinaryLengthAsUTF8(value) * bitmapIndex.getBitmap(bitmapIndex.getIndex(value)).size();
}
}
}
if (analyzingMinMax() && cardinality > 0) {
min = Strings.nullToEmpty(bitmapIndex.getValue(0));
max = Strings.nullToEmpty(bitmapIndex.getValue(cardinality - 1));
}
return new ColumnAnalysis(capabilities.getType().name(), capabilities.hasMultipleValues(), size, analyzingCardinality() ? cardinality : 0, min, max, null);
}
Aggregations