use of org.apache.druid.segment.QueryableIndexStorageAdapter in project druid by druid-io.
the class ExpressionFilterBenchmark method nativeFilter.
@Benchmark
public void nativeFilter(Blackhole blackhole) {
final Sequence<Cursor> cursors = new QueryableIndexStorageAdapter(index).makeCursors(nativeFilter.toFilter(), index.getDataInterval(), VirtualColumns.EMPTY, Granularities.ALL, false, null);
final List<?> results = cursors.map(cursor -> {
final ColumnValueSelector selector = cursor.getColumnSelectorFactory().makeColumnValueSelector("x");
consumeString(cursor, selector, blackhole);
return null;
}).toList();
blackhole.consume(results);
}
use of org.apache.druid.segment.QueryableIndexStorageAdapter in project druid by druid-io.
the class ExpressionFilterBenchmark method expressionFilter.
@Benchmark
public void expressionFilter(Blackhole blackhole) {
final Sequence<Cursor> cursors = new QueryableIndexStorageAdapter(index).makeCursors(expressionFilter.toFilter(), index.getDataInterval(), VirtualColumns.EMPTY, Granularities.ALL, false, null);
final List<?> results = cursors.map(cursor -> {
final ColumnValueSelector selector = cursor.getColumnSelectorFactory().makeColumnValueSelector("x");
consumeString(cursor, selector, blackhole);
return null;
}).toList();
blackhole.consume(results);
}
use of org.apache.druid.segment.QueryableIndexStorageAdapter in project druid by druid-io.
the class ExpressionSelectorBenchmark method arithmeticOnLong.
@Benchmark
public void arithmeticOnLong(Blackhole blackhole) {
final Sequence<Cursor> cursors = new QueryableIndexStorageAdapter(index).makeCursors(null, index.getDataInterval(), VirtualColumns.create(ImmutableList.of(new ExpressionVirtualColumn("v", "n + 1", ColumnType.LONG, TestExprMacroTable.INSTANCE))), Granularities.ALL, false, null);
final List<?> results = cursors.map(cursor -> {
final ColumnValueSelector selector = cursor.getColumnSelectorFactory().makeColumnValueSelector("v");
consumeLong(cursor, selector, blackhole);
return null;
}).toList();
blackhole.consume(results);
}
use of org.apache.druid.segment.QueryableIndexStorageAdapter in project druid by druid-io.
the class ExpressionSelectorBenchmark method timeFloorUsingExpression.
@Benchmark
public void timeFloorUsingExpression(Blackhole blackhole) {
final Sequence<Cursor> cursors = new QueryableIndexStorageAdapter(index).makeCursors(null, index.getDataInterval(), VirtualColumns.create(ImmutableList.of(new ExpressionVirtualColumn("v", "timestamp_floor(__time, 'PT1H')", ColumnType.LONG, TestExprMacroTable.INSTANCE))), Granularities.ALL, false, null);
final List<?> results = cursors.map(cursor -> {
final ColumnValueSelector selector = cursor.getColumnSelectorFactory().makeColumnValueSelector("v");
consumeLong(cursor, selector, blackhole);
return null;
}).toList();
blackhole.consume(results);
}
use of org.apache.druid.segment.QueryableIndexStorageAdapter in project druid by druid-io.
the class ExpressionSelectorBenchmark method timeFloorUsingCursor.
@Benchmark
public void timeFloorUsingCursor(Blackhole blackhole) {
final Sequence<Cursor> cursors = new QueryableIndexStorageAdapter(index).makeCursors(null, index.getDataInterval(), VirtualColumns.EMPTY, Granularities.HOUR, false, null);
final List<Long> results = cursors.map(cursor -> {
long count = 0L;
while (!cursor.isDone()) {
count++;
cursor.advance();
}
return count;
}).toList();
long count = 0L;
for (Long result : results) {
count += result;
}
blackhole.consume(count);
}
Aggregations