use of io.crate.execution.engine.aggregation.impl.AggregationImplModule in project crate by crate.
the class AggregateCollectorBenchmark method setup.
@Setup
public void setup() {
InputCollectExpression inExpr0 = new InputCollectExpression(0);
Functions functions = new ModulesBuilder().add(new AggregationImplModule()).createInjector().getInstance(Functions.class);
SumAggregation<?> sumAggregation = (SumAggregation<?>) functions.getQualified(Signature.aggregate(SumAggregation.NAME, DataTypes.INTEGER.getTypeSignature(), DataTypes.LONG.getTypeSignature()), List.of(DataTypes.INTEGER), DataTypes.INTEGER);
var memoryManager = new OnHeapMemoryManager(bytes -> {
});
collector = new AggregateCollector(Collections.singletonList(inExpr0), RamAccounting.NO_ACCOUNTING, memoryManager, Version.CURRENT, AggregateMode.ITER_FINAL, new AggregationFunction[] { sumAggregation }, Version.CURRENT, new Input[][] { { inExpr0 } }, new Input[] { Literal.BOOLEAN_TRUE });
}
use of io.crate.execution.engine.aggregation.impl.AggregationImplModule in project crate by crate.
the class GroupingStringCollectorBenchmark method createGroupingCollector.
@Setup
public void createGroupingCollector() {
Functions functions = new ModulesBuilder().add(new AggregationImplModule()).createInjector().getInstance(Functions.class);
groupByMinCollector = createGroupByMinBytesRefCollector(functions);
memoryManager = new OnHeapMemoryManager(bytes -> {
});
List<String> keys = new ArrayList<>(Locale.getISOCountries().length);
keys.addAll(Arrays.asList(Locale.getISOCountries()));
rows = new ArrayList<>(20_000_000);
for (int i = 0; i < 20_000_000; i++) {
rows.add(new Row1(keys.get(i % keys.size())));
}
}
use of io.crate.execution.engine.aggregation.impl.AggregationImplModule in project crate by crate.
the class GroupingLongCollectorBenchmark method createGroupingCollector.
@Setup
public void createGroupingCollector() throws Exception {
IndexWriter iw = new IndexWriter(new ByteBuffersDirectory(), new IndexWriterConfig(new StandardAnalyzer()));
Functions functions = new ModulesBuilder().add(new AggregationImplModule()).createInjector().getInstance(Functions.class);
SumAggregation<?> sumAgg = (SumAggregation<?>) functions.getQualified(Signature.aggregate(SumAggregation.NAME, DataTypes.INTEGER.getTypeSignature(), DataTypes.LONG.getTypeSignature()), List.of(DataTypes.INTEGER), DataTypes.INTEGER);
var memoryManager = new OnHeapMemoryManager(bytes -> {
});
groupBySumCollector = createGroupBySumCollector(sumAgg, memoryManager);
int size = 20_000_000;
rows = new ArrayList<>(size);
numbers = new long[size];
for (int i = 0; i < size; i++) {
long value = (long) i % 200;
rows.add(new Row1(value));
numbers[i] = value;
var doc = new Document();
doc.add(new NumericDocValuesField("x", value));
doc.add(new SortedNumericDocValuesField("y", value));
iw.addDocument(doc);
}
iw.commit();
iw.forceMerge(1, true);
searcher = new IndexSearcher(DirectoryReader.open(iw));
}
Aggregations