Search in sources :

Example 1 with OffHeapMemoryManager

use of io.crate.memory.OffHeapMemoryManager 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)

Aggregations

RamAccounting (io.crate.breaker.RamAccounting)1 Input (io.crate.data.Input)1 Row (io.crate.data.Row)1 Row1 (io.crate.data.Row1)1 AggregateCollector (io.crate.execution.engine.aggregation.AggregateCollector)1 AggregationFunction (io.crate.execution.engine.aggregation.AggregationFunction)1 HyperLogLogPlusPlus (io.crate.execution.engine.aggregation.impl.HyperLogLogPlusPlus)1 InputCollectExpression (io.crate.execution.engine.collect.InputCollectExpression)1 AggregateMode (io.crate.expression.symbol.AggregateMode)1 Literal (io.crate.expression.symbol.Literal)1 OffHeapMemoryManager (io.crate.memory.OffHeapMemoryManager)1 OnHeapMemoryManager (io.crate.memory.OnHeapMemoryManager)1 Functions (io.crate.metadata.Functions)1 Signature (io.crate.metadata.functions.Signature)1 ExtraFunctionsModule (io.crate.module.ExtraFunctionsModule)1 DataTypes (io.crate.types.DataTypes)1 StandardCharsets (java.nio.charset.StandardCharsets)1 Collections (java.util.Collections)1 List (java.util.List)1 TimeUnit (java.util.concurrent.TimeUnit)1