use of io.crate.execution.engine.collect.InputCollectExpression 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.collect.InputCollectExpression in project crate by crate.
the class GroupingStringCollectorBenchmark method createGroupByMinBytesRefCollector.
private GroupingCollector createGroupByMinBytesRefCollector(Functions functions) {
InputCollectExpression keyInput = new InputCollectExpression(0);
List<Input<?>> keyInputs = Collections.singletonList(keyInput);
CollectExpression[] collectExpressions = new CollectExpression[] { keyInput };
MinimumAggregation minAgg = (MinimumAggregation) functions.getQualified(Signature.aggregate(MinimumAggregation.NAME, DataTypes.STRING.getTypeSignature(), DataTypes.STRING.getTypeSignature()), List.of(DataTypes.STRING), DataTypes.STRING);
return GroupingCollector.singleKey(collectExpressions, AggregateMode.ITER_FINAL, new AggregationFunction[] { minAgg }, new Input[][] { new Input[] { keyInput } }, new Input[] { Literal.BOOLEAN_TRUE }, RamAccounting.NO_ACCOUNTING, memoryManager, Version.CURRENT, keyInputs.get(0), DataTypes.STRING, Version.CURRENT);
}
use of io.crate.execution.engine.collect.InputCollectExpression 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.execution.engine.collect.InputCollectExpression in project crate by crate.
the class GroupingLongCollectorBenchmark method createGroupBySumCollector.
private static GroupingCollector createGroupBySumCollector(AggregationFunction sumAgg, MemoryManager memoryManager) {
InputCollectExpression keyInput = new InputCollectExpression(0);
List<Input<?>> keyInputs = Arrays.<Input<?>>asList(keyInput);
CollectExpression[] collectExpressions = new CollectExpression[] { keyInput };
return GroupingCollector.singleKey(collectExpressions, AggregateMode.ITER_FINAL, new AggregationFunction[] { sumAgg }, new Input[][] { new Input[] { keyInput } }, new Input[] { Literal.BOOLEAN_TRUE }, RamAccounting.NO_ACCOUNTING, memoryManager, Version.CURRENT, keyInputs.get(0), DataTypes.LONG, Version.CURRENT);
}
use of io.crate.execution.engine.collect.InputCollectExpression in project crate by crate.
the class RowsBatchIteratorBenchmark method measureConsumeWindowBatchIterator.
@Benchmark
public void measureConsumeWindowBatchIterator(Blackhole blackhole) throws Exception {
InputCollectExpression input = new InputCollectExpression(0);
BatchIterator<Row> batchIterator = WindowFunctionBatchIterator.of(new InMemoryBatchIterator<>(rows, SENTINEL, false), new NoRowAccounting<>(), (partitionStart, partitionEnd, currentIndex, sortedRows) -> 0, (partitionStart, partitionEnd, currentIndex, sortedRows) -> currentIndex, (arg1, arg2) -> 0, (arg1, arg2) -> 0, 1, () -> 1, Runnable::run, List.of(lastValueIntFunction), List.of(), new Boolean[] { null }, new Input[] { input });
BatchIterators.collect(batchIterator, Collectors.summingInt(x -> {
blackhole.consume(x);
return 1;
})).get();
}
Aggregations