From 91199de361bc81dd943f06d8dd2359ba294291b9 Mon Sep 17 00:00:00 2001 From: ChrisHegarty Date: Tue, 19 Sep 2023 13:40:26 +0100 Subject: [PATCH] fix benchmark builds --- .../compute/operator/AggregatorBenchmark.java | 14 ++++++++++++-- .../benchmark/compute/operator/EvalBenchmark.java | 7 ++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/benchmarks/src/main/java/org/elasticsearch/benchmark/compute/operator/AggregatorBenchmark.java b/benchmarks/src/main/java/org/elasticsearch/benchmark/compute/operator/AggregatorBenchmark.java index 75fe76ea8fbb0..c4037bb4920cb 100644 --- a/benchmarks/src/main/java/org/elasticsearch/benchmark/compute/operator/AggregatorBenchmark.java +++ b/benchmarks/src/main/java/org/elasticsearch/benchmark/compute/operator/AggregatorBenchmark.java @@ -9,6 +9,7 @@ package org.elasticsearch.benchmark.compute.operator; import org.apache.lucene.util.BytesRef; +import org.elasticsearch.common.breaker.NoopCircuitBreaker; import org.elasticsearch.common.util.BigArrays; import org.elasticsearch.compute.aggregation.AggregatorFunctionSupplier; import org.elasticsearch.compute.aggregation.AggregatorMode; @@ -23,6 +24,7 @@ import org.elasticsearch.compute.aggregation.SumLongAggregatorFunctionSupplier; import org.elasticsearch.compute.aggregation.blockhash.BlockHash; import org.elasticsearch.compute.data.Block; +import org.elasticsearch.compute.data.BlockFactory; import org.elasticsearch.compute.data.BooleanBlock; import org.elasticsearch.compute.data.BytesRefBlock; import org.elasticsearch.compute.data.DoubleArrayVector; @@ -139,10 +141,11 @@ private static Operator operator(String grouping, String op, String dataType) { ); default -> throw new IllegalArgumentException("unsupported grouping [" + grouping + "]"); }; + DriverContext driverContext = driverContext(); return new HashAggregationOperator( List.of(supplier(op, dataType, groups.size()).groupingAggregatorFactory(AggregatorMode.SINGLE)), - () -> BlockHash.build(groups, BIG_ARRAYS, 16 * 1024, false), - new DriverContext(BigArrays.NON_RECYCLING_INSTANCE) + () -> BlockHash.build(groups, driverContext, 16 * 1024, false), + driverContext ); } @@ -576,4 +579,11 @@ private static void run(String grouping, String op, String blockType, int opCoun operator.finish(); checkExpected(grouping, op, blockType, dataType, operator.getOutput(), opCount); } + + static DriverContext driverContext() { + return new DriverContext( + BigArrays.NON_RECYCLING_INSTANCE, + BlockFactory.getInstance(new NoopCircuitBreaker("noop"), BigArrays.NON_RECYCLING_INSTANCE) + ); + } } diff --git a/benchmarks/src/main/java/org/elasticsearch/benchmark/compute/operator/EvalBenchmark.java b/benchmarks/src/main/java/org/elasticsearch/benchmark/compute/operator/EvalBenchmark.java index 909bf16815a0d..82c9416515d24 100644 --- a/benchmarks/src/main/java/org/elasticsearch/benchmark/compute/operator/EvalBenchmark.java +++ b/benchmarks/src/main/java/org/elasticsearch/benchmark/compute/operator/EvalBenchmark.java @@ -8,8 +8,10 @@ package org.elasticsearch.benchmark.compute.operator; +import org.elasticsearch.common.breaker.NoopCircuitBreaker; import org.elasticsearch.common.util.BigArrays; import org.elasticsearch.compute.data.Block; +import org.elasticsearch.compute.data.BlockFactory; import org.elasticsearch.compute.data.BooleanBlock; import org.elasticsearch.compute.data.BooleanVector; import org.elasticsearch.compute.data.IntBlock; @@ -262,6 +264,9 @@ private static void run(String operation) { } static DriverContext driverContext() { - return new DriverContext(BigArrays.NON_RECYCLING_INSTANCE); + return new DriverContext( + BigArrays.NON_RECYCLING_INSTANCE, + BlockFactory.getInstance(new NoopCircuitBreaker("noop"), BigArrays.NON_RECYCLING_INSTANCE) + ); } }