use of io.crate.module.ExtraFunctionsModule in project crate by crate.
the class HyperLogLogDistinctAggregationBenchmark method setUp.
@Setup
public void setUp() throws Exception {
hash = new MurmurHash3.Hash128();
final InputCollectExpression inExpr0 = new InputCollectExpression(0);
Functions functions = new ModulesBuilder().add(new ExtraFunctionsModule()).createInjector().getInstance(Functions.class);
final HyperLogLogDistinctAggregation hllAggregation = (HyperLogLogDistinctAggregation) functions.getQualified(Signature.aggregate(HyperLogLogDistinctAggregation.NAME, DataTypes.STRING.getTypeSignature(), DataTypes.LONG.getTypeSignature()), List.of(DataTypes.STRING), DataTypes.STRING);
onHeapMemoryManager = new OnHeapMemoryManager(bytes -> {
});
offHeapMemoryManager = new OffHeapMemoryManager();
hyperLogLogPlusPlus = new HyperLogLogPlusPlus(HyperLogLogPlusPlus.DEFAULT_PRECISION, onHeapMemoryManager::allocate);
onHeapCollector = new AggregateCollector(Collections.singletonList(inExpr0), RamAccounting.NO_ACCOUNTING, onHeapMemoryManager, Version.CURRENT, AggregateMode.ITER_FINAL, new AggregationFunction[] { hllAggregation }, Version.CURRENT, new Input[][] { { inExpr0 } }, new Input[] { Literal.BOOLEAN_TRUE });
offHeapCollector = new AggregateCollector(Collections.singletonList(inExpr0), RamAccounting.NO_ACCOUNTING, offHeapMemoryManager, Version.CURRENT, AggregateMode.ITER_FINAL, new AggregationFunction[] { hllAggregation }, Version.CURRENT, new Input[][] { { inExpr0 } }, new Input[] { Literal.BOOLEAN_TRUE });
}
use of io.crate.module.ExtraFunctionsModule in project crate by crate.
the class RowsBatchIteratorBenchmark method setup.
@Setup
public void setup() {
rows = IntStream.range(0, 10_000_000).mapToObj(i -> new RowN(i)).collect(Collectors.toList());
Functions functions = new ModulesBuilder().add(new ExtraFunctionsModule()).createInjector().getInstance(Functions.class);
lastValueIntFunction = (WindowFunction) functions.getQualified(Signature.window(LAST_VALUE_NAME, parseTypeSignature("E"), parseTypeSignature("E")).withTypeVariableConstraints(typeVariable("E")), List.of(DataTypes.INTEGER), DataTypes.INTEGER);
}
Aggregations