use of org.apache.druid.segment.data.IndexedInts in project druid by druid-io.
the class IncrementalIndexReadBenchmark method readWithFilters.
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MICROSECONDS)
public void readWithFilters(Blackhole blackhole) {
DimFilter filter = new OrDimFilter(Arrays.asList(new BoundDimFilter("dimSequential", "-1", "-1", true, true, null, null, StringComparators.ALPHANUMERIC), new JavaScriptDimFilter("dimSequential", "function(x) { return false }", null, JavaScriptConfig.getEnabledInstance()), new RegexDimFilter("dimSequential", "X", null), new SearchQueryDimFilter("dimSequential", new ContainsSearchQuerySpec("X", false), null), new InDimFilter("dimSequential", Collections.singletonList("X"), null)));
IncrementalIndexStorageAdapter sa = new IncrementalIndexStorageAdapter(incIndex);
Sequence<Cursor> cursors = makeCursors(sa, filter);
Cursor cursor = cursors.limit(1).toList().get(0);
List<DimensionSelector> selectors = new ArrayList<>();
selectors.add(makeDimensionSelector(cursor, "dimSequential"));
selectors.add(makeDimensionSelector(cursor, "dimZipf"));
selectors.add(makeDimensionSelector(cursor, "dimUniform"));
selectors.add(makeDimensionSelector(cursor, "dimSequentialHalfNull"));
cursor.reset();
while (!cursor.isDone()) {
for (DimensionSelector selector : selectors) {
IndexedInts row = selector.getRow();
blackhole.consume(selector.lookupName(row.get(0)));
}
cursor.advance();
}
}
use of org.apache.druid.segment.data.IndexedInts in project druid by druid-io.
the class DistinctCountBufferAggregator method aggregate.
@Override
public void aggregate(ByteBuffer buf, int position) {
MutableBitmap mutableBitmap = getMutableBitmap(position);
IndexedInts row = selector.getRow();
for (int i = 0, rowSize = row.size(); i < rowSize; i++) {
int index = row.get(i);
mutableBitmap.add(index);
}
buf.putLong(position, mutableBitmap.size());
}
use of org.apache.druid.segment.data.IndexedInts in project druid by druid-io.
the class DistinctCountAggregator method aggregate.
@Override
public void aggregate() {
IndexedInts row = selector.getRow();
for (int i = 0, rowSize = row.size(); i < rowSize; i++) {
int index = row.get(i);
mutableBitmap.add(index);
}
}
use of org.apache.druid.segment.data.IndexedInts in project druid by druid-io.
the class StringGroupByColumnSelectorStrategy method getOnlyValue.
@Override
public Object getOnlyValue(ColumnValueSelector selector) {
final DimensionSelector dimSelector = (DimensionSelector) selector;
final IndexedInts row = dimSelector.getRow();
Preconditions.checkState(row.size() < 2, "Not supported for multi-value dimensions");
return row.size() == 1 ? row.get(0) : GROUP_BY_MISSING_VALUE;
}
use of org.apache.druid.segment.data.IndexedInts in project druid by druid-io.
the class StringGroupByColumnSelectorStrategy method checkRowIndexAndAddValueToGroupingKey.
@Override
public boolean checkRowIndexAndAddValueToGroupingKey(int keyBufferPosition, Object rowObj, int rowValIdx, ByteBuffer keyBuffer) {
IndexedInts row = (IndexedInts) rowObj;
int rowSize = row.size();
if (rowValIdx < rowSize) {
keyBuffer.putInt(keyBufferPosition, row.get(rowValIdx));
return true;
} else {
return false;
}
}
Aggregations