use of io.crate.memory.OnHeapMemoryManager 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.memory.OnHeapMemoryManager 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.memory.OnHeapMemoryManager 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.memory.OnHeapMemoryManager in project crate by crate.
the class ProjectionToProjectorVisitorTest method prepare.
@Before
public void prepare() {
nodeCtx = createNodeContext();
MockitoAnnotations.initMocks(this);
visitor = new ProjectionToProjectorVisitor(clusterService, new NodeLimits(new ClusterSettings(Settings.EMPTY, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS)), new NoneCircuitBreakerService(), nodeCtx, THREAD_POOL, Settings.EMPTY, mock(TransportActionProvider.class, Answers.RETURNS_DEEP_STUBS), new InputFactory(nodeCtx), EvaluatingNormalizer.functionOnlyNormalizer(nodeCtx), t -> null, t -> null);
memoryManager = new OnHeapMemoryManager(usedBytes -> {
});
avgSignature = Signature.aggregate("avg", DataTypes.INTEGER.getTypeSignature(), DataTypes.DOUBLE.getTypeSignature());
}
use of io.crate.memory.OnHeapMemoryManager in project crate by crate.
the class ProjectorsTest method prepare.
@Before
public void prepare() throws Exception {
nodeCtx = createNodeContext();
memoryManager = new OnHeapMemoryManager(bytes -> {
});
projectorFactory = new ProjectionToProjectorVisitor(clusterService, new NodeLimits(new ClusterSettings(Settings.EMPTY, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS)), new NoneCircuitBreakerService(), nodeCtx, THREAD_POOL, Settings.EMPTY, mock(TransportActionProvider.class, Answers.RETURNS_DEEP_STUBS), new InputFactory(nodeCtx), new EvaluatingNormalizer(nodeCtx, RowGranularity.SHARD, r -> Literal.ofUnchecked(r.valueType(), r.valueType().sanitizeValue("1")), null), t -> null, t -> null, Version.CURRENT, new ShardId("dummy", UUID.randomUUID().toString(), 0), null);
}
Aggregations