Search in sources :

Example 1 with InputCollectExpression

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 });
}
Also used : Input(io.crate.data.Input) InputCollectExpression(io.crate.execution.engine.collect.InputCollectExpression) OnHeapMemoryManager(io.crate.memory.OnHeapMemoryManager) SumAggregation(io.crate.execution.engine.aggregation.impl.SumAggregation) Functions(io.crate.metadata.Functions) ModulesBuilder(org.elasticsearch.common.inject.ModulesBuilder) AggregationImplModule(io.crate.execution.engine.aggregation.impl.AggregationImplModule) Setup(org.openjdk.jmh.annotations.Setup)

Example 2 with InputCollectExpression

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);
}
Also used : Input(io.crate.data.Input) InputCollectExpression(io.crate.execution.engine.collect.InputCollectExpression) CollectExpression(io.crate.execution.engine.collect.CollectExpression) InputCollectExpression(io.crate.execution.engine.collect.InputCollectExpression) MinimumAggregation(io.crate.execution.engine.aggregation.impl.MinimumAggregation)

Example 3 with InputCollectExpression

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 });
}
Also used : IntStream(java.util.stream.IntStream) Input(io.crate.data.Input) OffHeapMemoryManager(io.crate.memory.OffHeapMemoryManager) BenchmarkMode(org.openjdk.jmh.annotations.BenchmarkMode) Scope(org.openjdk.jmh.annotations.Scope) Warmup(org.openjdk.jmh.annotations.Warmup) Function(java.util.function.Function) ExtraFunctionsModule(io.crate.module.ExtraFunctionsModule) Functions(io.crate.metadata.Functions) OutputTimeUnit(org.openjdk.jmh.annotations.OutputTimeUnit) BiConsumer(java.util.function.BiConsumer) TearDown(org.openjdk.jmh.annotations.TearDown) Setup(org.openjdk.jmh.annotations.Setup) Mode(org.openjdk.jmh.annotations.Mode) AggregationFunction(io.crate.execution.engine.aggregation.AggregationFunction) HyperLogLogPlusPlus(io.crate.execution.engine.aggregation.impl.HyperLogLogPlusPlus) Signature(io.crate.metadata.functions.Signature) MurmurHash3(org.elasticsearch.common.hash.MurmurHash3) State(org.openjdk.jmh.annotations.State) RamAccounting(io.crate.breaker.RamAccounting) Collectors(java.util.stream.Collectors) InputCollectExpression(io.crate.execution.engine.collect.InputCollectExpression) Benchmark(org.openjdk.jmh.annotations.Benchmark) StandardCharsets(java.nio.charset.StandardCharsets) TimeUnit(java.util.concurrent.TimeUnit) List(java.util.List) Version(org.elasticsearch.Version) Row(io.crate.data.Row) Literal(io.crate.expression.symbol.Literal) AggregateMode(io.crate.expression.symbol.AggregateMode) DataTypes(io.crate.types.DataTypes) AggregateCollector(io.crate.execution.engine.aggregation.AggregateCollector) Fork(org.openjdk.jmh.annotations.Fork) OnHeapMemoryManager(io.crate.memory.OnHeapMemoryManager) ModulesBuilder(org.elasticsearch.common.inject.ModulesBuilder) Collections(java.util.Collections) Row1(io.crate.data.Row1) OffHeapMemoryManager(io.crate.memory.OffHeapMemoryManager) OnHeapMemoryManager(io.crate.memory.OnHeapMemoryManager) Functions(io.crate.metadata.Functions) AggregateCollector(io.crate.execution.engine.aggregation.AggregateCollector) ExtraFunctionsModule(io.crate.module.ExtraFunctionsModule) AggregationFunction(io.crate.execution.engine.aggregation.AggregationFunction) Input(io.crate.data.Input) InputCollectExpression(io.crate.execution.engine.collect.InputCollectExpression) HyperLogLogPlusPlus(io.crate.execution.engine.aggregation.impl.HyperLogLogPlusPlus) ModulesBuilder(org.elasticsearch.common.inject.ModulesBuilder) MurmurHash3(org.elasticsearch.common.hash.MurmurHash3) Setup(org.openjdk.jmh.annotations.Setup)

Example 4 with InputCollectExpression

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);
}
Also used : Input(io.crate.data.Input) InputCollectExpression(io.crate.execution.engine.collect.InputCollectExpression) InputCollectExpression(io.crate.execution.engine.collect.InputCollectExpression) CollectExpression(io.crate.execution.engine.collect.CollectExpression)

Example 5 with InputCollectExpression

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();
}
Also used : InputCollectExpression(io.crate.execution.engine.collect.InputCollectExpression) Row(io.crate.data.Row) Benchmark(org.openjdk.jmh.annotations.Benchmark)

Aggregations

InputCollectExpression (io.crate.execution.engine.collect.InputCollectExpression)9 Input (io.crate.data.Input)6 Row (io.crate.data.Row)5 CollectExpression (io.crate.execution.engine.collect.CollectExpression)4 RowN (io.crate.data.RowN)3 OnHeapMemoryManager (io.crate.memory.OnHeapMemoryManager)3 List (java.util.List)3 RamAccounting (io.crate.breaker.RamAccounting)2 BatchIterator (io.crate.data.BatchIterator)2 InMemoryBatchIterator (io.crate.data.InMemoryBatchIterator)2 AggregationFunction (io.crate.execution.engine.aggregation.AggregationFunction)2 NodeLimits (io.crate.execution.jobs.NodeLimits)2 InputFactory (io.crate.expression.InputFactory)2 InputColumn (io.crate.expression.symbol.InputColumn)2 Literal (io.crate.expression.symbol.Literal)2 Symbol (io.crate.expression.symbol.Symbol)2 Functions (io.crate.metadata.Functions)2 TestingRowConsumer (io.crate.testing.TestingRowConsumer)2 TimeUnit (java.util.concurrent.TimeUnit)2 Collectors (java.util.stream.Collectors)2