use of org.apache.druid.segment.DimensionSelector in project druid by druid-io.
the class ExpressionSelectorBenchmark method strlenUsingExtractionFn.
@Benchmark
public void strlenUsingExtractionFn(Blackhole blackhole) {
final Sequence<Cursor> cursors = new QueryableIndexStorageAdapter(index).makeCursors(null, index.getDataInterval(), VirtualColumns.EMPTY, Granularities.ALL, false, null);
final List<?> results = cursors.map(cursor -> {
final DimensionSelector selector = cursor.getColumnSelectorFactory().makeDimensionSelector(new ExtractionDimensionSpec("x", "v", StrlenExtractionFn.instance()));
consumeDimension(cursor, selector, blackhole);
return null;
}).toList();
blackhole.consume(results);
}
use of org.apache.druid.segment.DimensionSelector in project druid by druid-io.
the class ExpressionSelectorBenchmark method strlenUsingExpressionAsString.
@Benchmark
public void strlenUsingExpressionAsString(Blackhole blackhole) {
final Sequence<Cursor> cursors = new QueryableIndexStorageAdapter(index).makeCursors(null, index.getDataInterval(), VirtualColumns.create(ImmutableList.of(new ExpressionVirtualColumn("v", "strlen(s)", ColumnType.STRING, TestExprMacroTable.INSTANCE))), Granularities.ALL, false, null);
final List<?> results = cursors.map(cursor -> {
final DimensionSelector selector = cursor.getColumnSelectorFactory().makeDimensionSelector(new DefaultDimensionSpec("v", "v", ColumnType.STRING));
consumeDimension(cursor, selector, blackhole);
return null;
}).toList();
blackhole.consume(results);
}
use of org.apache.druid.segment.DimensionSelector in project druid by druid-io.
the class FilterPartitionBenchmark method readCursors.
private void readCursors(Sequence<Cursor> cursors, Blackhole blackhole) {
final Sequence<Void> voids = Sequences.map(cursors, input -> {
List<DimensionSelector> selectors = new ArrayList<>();
selectors.add(input.getColumnSelectorFactory().makeDimensionSelector(new DefaultDimensionSpec("dimSequential", null)));
while (!input.isDone()) {
for (DimensionSelector selector : selectors) {
IndexedInts row = selector.getRow();
blackhole.consume(selector.lookupName(row.get(0)));
}
input.advance();
}
return null;
});
blackhole.consume(voids.toList());
}
use of org.apache.druid.segment.DimensionSelector in project druid by druid-io.
the class ExpressionSelectorBenchmark method timeFormatUsingExpression.
@Benchmark
public void timeFormatUsingExpression(Blackhole blackhole) {
final Sequence<Cursor> cursors = new QueryableIndexStorageAdapter(index).makeCursors(null, index.getDataInterval(), VirtualColumns.create(ImmutableList.of(new ExpressionVirtualColumn("v", "timestamp_format(__time, 'yyyy-MM-dd')", ColumnType.STRING, TestExprMacroTable.INSTANCE))), Granularities.ALL, false, null);
final List<?> results = cursors.map(cursor -> {
final DimensionSelector selector = cursor.getColumnSelectorFactory().makeDimensionSelector(DefaultDimensionSpec.of("v"));
consumeDimension(cursor, selector, blackhole);
return null;
}).toList();
blackhole.consume(results);
}
use of org.apache.druid.segment.DimensionSelector in project druid by druid-io.
the class ExpressionSelectorBenchmark method timeFormatUsingExtractionFn.
@Benchmark
public void timeFormatUsingExtractionFn(Blackhole blackhole) {
final Sequence<Cursor> cursors = new QueryableIndexStorageAdapter(index).makeCursors(null, index.getDataInterval(), VirtualColumns.EMPTY, Granularities.ALL, false, null);
final List<?> results = cursors.map(cursor -> {
final DimensionSelector selector = cursor.getColumnSelectorFactory().makeDimensionSelector(new ExtractionDimensionSpec(ColumnHolder.TIME_COLUMN_NAME, "v", new TimeFormatExtractionFn("yyyy-MM-dd", null, null, null, false)));
consumeDimension(cursor, selector, blackhole);
return null;
}).toList();
blackhole.consume(results);
}
Aggregations