Skip to content
3 changes: 0 additions & 3 deletions muted-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -426,9 +426,6 @@ tests:
- class: org.elasticsearch.backwards.MixedClusterClientYamlTestSuiteIT
method: test {p0=search/350_point_in_time/point-in-time with index filter}
issue: https://github.com/elastic/elasticsearch/issues/127741
- class: org.elasticsearch.compute.aggregation.FilteredGroupingAggregatorFunctionTests
method: testSimpleCircuitBreaking
issue: https://github.com/elastic/elasticsearch/issues/127833
- class: org.elasticsearch.packaging.test.DockerTests
method: test025SyncPluginsUsingProxy
issue: https://github.com/elastic/elasticsearch/issues/127138
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ protected final int aggregatorIntermediateBlockCount() {
protected abstract void assertSimpleOutput(List<Block> input, Block result);

@Override
protected Operator.OperatorFactory simpleWithMode(AggregatorMode mode) {
protected Operator.OperatorFactory simpleWithMode(SimpleOptions options, AggregatorMode mode) {
return simpleWithMode(mode, Function.identity());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,16 @@ protected DataType acceptedDataType() {
};

@Override
protected final Operator.OperatorFactory simpleWithMode(AggregatorMode mode) {
return simpleWithMode(mode, Function.identity());
protected final Operator.OperatorFactory simpleWithMode(SimpleOptions options, AggregatorMode mode) {
return simpleWithMode(options, mode, Function.identity());
}

protected List<Integer> channels(AggregatorMode mode) {
return mode.isInputPartial() ? range(1, 1 + aggregatorIntermediateBlockCount()).boxed().toList() : List.of(1);
}

private Operator.OperatorFactory simpleWithMode(
SimpleOptions options,
AggregatorMode mode,
Function<AggregatorFunctionSupplier, AggregatorFunctionSupplier> wrap
) {
Expand All @@ -108,13 +109,24 @@ private Operator.OperatorFactory simpleWithMode(
if (randomBoolean()) {
supplier = chunkGroups(emitChunkSize, supplier);
}
return new RandomizingHashAggregationOperatorFactory(
List.of(new BlockHash.GroupSpec(0, ElementType.LONG)),
mode,
List.of(supplier.groupingAggregatorFactory(mode, channels(mode))),
randomPageSize(),
null
);

if (options.requiresDeterministicFactory()) {
return new HashAggregationOperator.HashAggregationOperatorFactory(
List.of(new BlockHash.GroupSpec(0, ElementType.LONG)),
mode,
List.of(supplier.groupingAggregatorFactory(mode, channels(mode))),
randomPageSize(),
null
);
} else {
return new RandomizingHashAggregationOperatorFactory(
List.of(new BlockHash.GroupSpec(0, ElementType.LONG)),
mode,
List.of(supplier.groupingAggregatorFactory(mode, channels(mode))),
randomPageSize(),
null
);
}
}

@Override
Expand Down Expand Up @@ -389,6 +401,7 @@ public final void testEmptyInput() {

public final void testAllFiltered() {
Operator.OperatorFactory factory = simpleWithMode(
SimpleOptions.DEFAULT,
AggregatorMode.SINGLE,
agg -> new FilteredAggregatorFunctionSupplier(agg, ConstantBooleanExpressionEvaluator.factory(false))
);
Expand All @@ -401,6 +414,7 @@ public final void testAllFiltered() {

public final void testNoneFiltered() {
Operator.OperatorFactory factory = simpleWithMode(
SimpleOptions.DEFAULT,
AggregatorMode.SINGLE,
agg -> new FilteredAggregatorFunctionSupplier(agg, ConstantBooleanExpressionEvaluator.factory(true))
);
Expand All @@ -414,6 +428,7 @@ public final void testNoneFiltered() {

public void testSomeFiltered() {
Operator.OperatorFactory factory = simpleWithMode(
SimpleOptions.DEFAULT,
AggregatorMode.SINGLE,
agg -> new FilteredAggregatorFunctionSupplier(agg, AddGarbageRowsSourceOperator.filterFactory())
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void closeIndex() throws IOException {
}

@Override
protected LuceneCountOperator.Factory simple() {
protected LuceneCountOperator.Factory simple(SimpleOptions options) {
return simple(randomFrom(DataPartitioning.values()), between(1, 10_000), 100);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void closeIndex() throws IOException {
}

@Override
protected LuceneMaxFactory simple() {
protected LuceneMaxFactory simple(SimpleOptions options) {
return simple(getNumberTypeTest(), randomFrom(DataPartitioning.values()), between(1, 10_000), 100);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void closeIndex() throws IOException {
}

@Override
protected LuceneMinFactory simple() {
protected LuceneMinFactory simple(SimpleOptions options) {
return simple(getNumberTypeTest(), randomFrom(DataPartitioning.values()), between(1, 10_000), 100);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void closeIndex() throws IOException {
}

@Override
protected LuceneSourceOperator.Factory simple() {
protected LuceneSourceOperator.Factory simple(SimpleOptions options) {
return simple(randomFrom(DataPartitioning.values()), between(1, 10_000), 100, scoring);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private void closeIndex() throws IOException {
}

@Override
protected LuceneTopNSourceOperator.Factory simple() {
protected LuceneTopNSourceOperator.Factory simple(SimpleOptions options) {
return simple(DataPartitioning.SHARD, 10_000, 100);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ private void closeIndex() throws IOException {
}

@Override
protected LuceneTopNSourceOperator.Factory simple() {
protected LuceneTopNSourceOperator.Factory simple(SimpleOptions options) {
return simple(DataPartitioning.SHARD, 10_000, 100);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ public void testMatchNone() throws Exception {
}

@Override
protected Operator.OperatorFactory simple() {
protected Operator.OperatorFactory simple(SimpleOptions options) {
return createTimeSeriesSourceOperator(directory, r -> this.reader = r, randomBoolean(), List.of(), 1, 1, false, writer -> {
long timestamp = DateFieldMapper.DEFAULT_DATE_TIME_FORMATTER.parseMillis("2024-01-01T00:00:00Z");
writeTS(writer, timestamp, new Object[] { "hostname", "host-01" }, new Object[] { "voltage", 2 });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ private IndexReader reader(String indexKey) {
}

@Override
protected Operator.OperatorFactory simple() {
protected Operator.OperatorFactory simple(SimpleOptions options) {
return factory(initShardContexts(), mapperService("index1").fieldType("long"), ElementType.LONG);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public void closeIndex() throws IOException {
}

@Override
protected Operator.OperatorFactory simple() {
protected Operator.OperatorFactory simple(SimpleOptions options) {
if (reader == null) {
// Init a reader if one hasn't been built, so things don't blow up
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protected SourceOperator simpleInput(BlockFactory blockFactory, int size) {
}

@Override
protected Operator.OperatorFactory simpleWithMode(AggregatorMode mode) {
protected Operator.OperatorFactory simpleWithMode(SimpleOptions options, AggregatorMode mode) {
List<Integer> sumChannels, maxChannels;
if (mode.isInputPartial()) {
int sumInterChannelCount = SumLongAggregatorFunction.intermediateStateDesc().size();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ protected void assertSimpleOutput(List<Page> input, List<Page> results) {
}

@Override
protected Operator.OperatorFactory simple() {
protected Operator.OperatorFactory simple(SimpleOptions options) {
return new ChangePointOperator.Factory(0, null, 0, 0);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public String toString() {
}

@Override
protected Operator.OperatorFactory simple() {
protected Operator.OperatorFactory simple(SimpleOptions options) {
Supplier<ColumnExtractOperator.Evaluator> expEval = () -> new FirstWord(0);
return new ColumnExtractOperator.Factory(
new ElementType[] { ElementType.BYTES_REF },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ protected void assertSimpleOutput(List<Page> input, List<Page> results) {
}

@Override
protected Operator.OperatorFactory simple() {
protected Operator.OperatorFactory simple(SimpleOptions options) {
return new ColumnLoadOperator.Factory(
new ColumnLoadOperator.Values(
"values",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void close() {}
}

@Override
protected Operator.OperatorFactory simple() {
protected Operator.OperatorFactory simple(SimpleOptions options) {
return new EvalOperator.EvalOperatorFactory(new EvalOperator.ExpressionEvaluator.Factory() {
@Override
public EvalOperator.ExpressionEvaluator get(DriverContext context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void close() {}
}

@Override
protected Operator.OperatorFactory simple() {
protected Operator.OperatorFactory simple(SimpleOptions options) {
return new FilterOperator.FilterOperatorFactory(new EvalOperator.ExpressionEvaluator.Factory() {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,18 @@ public abstract class ForkingOperatorTestCase extends OperatorTestCase {

private static final String ESQL_TEST_EXECUTOR = "esql_test_executor";

protected abstract Operator.OperatorFactory simpleWithMode(AggregatorMode mode);
protected abstract Operator.OperatorFactory simpleWithMode(SimpleOptions options, AggregatorMode mode);

/**
* Calls {@link #simpleWithMode(SimpleOptions, AggregatorMode)} with the default options.
*/
protected final Operator.OperatorFactory simpleWithMode(AggregatorMode mode) {
return simpleWithMode(SimpleOptions.DEFAULT, mode);
}

@Override
protected final Operator.OperatorFactory simple() {
return simpleWithMode(AggregatorMode.SINGLE);
protected final Operator.OperatorFactory simple(SimpleOptions options) {
return simpleWithMode(options, AggregatorMode.SINGLE);
}

public final void testInitialFinal() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected SourceOperator simpleInput(BlockFactory blockFactory, int size) {
}

@Override
protected Operator.OperatorFactory simpleWithMode(AggregatorMode mode) {
protected Operator.OperatorFactory simpleWithMode(SimpleOptions options, AggregatorMode mode) {
List<Integer> sumChannels, maxChannels;
if (mode.isInputPartial()) {
int sumChannelCount = SumLongAggregatorFunction.intermediateStateDesc().size();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ protected void assertSimpleOutput(List<Page> input, List<Page> results) {
}

@Override
protected Operator.OperatorFactory simple() {
protected Operator.OperatorFactory simple(SimpleOptions options) {
return new IteratorAppendPage.Factory();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ protected void assertSimpleOutput(List<Page> input, List<Page> results) {
}

@Override
protected Operator.OperatorFactory simple() {
protected Operator.OperatorFactory simple(SimpleOptions options) {
return new IteratorRemovePage.Factory();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

public class LimitOperatorTests extends OperatorTestCase {
@Override
protected LimitOperator.Factory simple() {
protected LimitOperator.Factory simple(SimpleOptions options) {
return new LimitOperator.Factory(100);
}

Expand Down Expand Up @@ -55,7 +55,7 @@ protected void assertSimpleOutput(List<Page> input, List<Page> results) {

public void testStatus() {
BlockFactory blockFactory = driverContext().blockFactory();
LimitOperator op = simple().get(driverContext());
LimitOperator op = simple(SimpleOptions.DEFAULT).get(driverContext());

LimitOperator.Status status = op.status();
assertThat(status.limit(), equalTo(100));
Expand All @@ -77,7 +77,7 @@ public void testStatus() {

public void testNeedInput() {
BlockFactory blockFactory = driverContext().blockFactory();
try (LimitOperator op = simple().get(driverContext())) {
try (LimitOperator op = simple(SimpleOptions.DEFAULT).get(driverContext())) {
assertTrue(op.needsInput());
Page p = new Page(blockFactory.newConstantNullBlock(10));
op.addInput(p);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected Page createPage(int positionOffset, int length) {
}

@Override
protected Operator.OperatorFactory simple() {
protected Operator.OperatorFactory simple(SimpleOptions options) {
return new MvExpandOperator.Factory(0, randomIntBetween(1, 1000));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

public class OutputOperatorTests extends AnyOperatorTestCase {
@Override
protected Operator.OperatorFactory simple() {
protected Operator.OperatorFactory simple(SimpleOptions options) {
return new OutputOperator.OutputOperatorFactory(List.of("a"), p -> p, p -> {});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ protected SourceOperator simpleInput(BlockFactory blockFactory, int end) {
}

@Override
protected Operator.OperatorFactory simple() {
protected Operator.OperatorFactory simple(SimpleOptions options) {
return new ProjectOperator.ProjectOperatorFactory(Arrays.asList(1));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ private void assertSimpleOutput(List<Page> input, List<Page> results, int keyCha
}

@Override
protected Operator.OperatorFactory simple() {
protected Operator.OperatorFactory simple(SimpleOptions options) {
return new RowInTableLookupOperator.Factory(
new RowInTableLookupOperator.Key[] {
new RowInTableLookupOperator.Key(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected void assertSimpleOutput(List<Page> input, List<Page> results) {
}

@Override
protected SampleOperator.Factory simple() {
protected SampleOperator.Factory simple(SimpleOptions options) {
return new SampleOperator.Factory(0.5, randomInt());
}

Expand All @@ -59,7 +59,7 @@ public void testAccuracy() {
int totalPositionCount = 0;

for (int iter = 0; iter < 10000; iter++) {
SampleOperator operator = simple().get(driverContext());
SampleOperator operator = simple(SimpleOptions.DEFAULT).get(driverContext());
operator.addInput(new Page(blockFactory.newConstantNullBlock(20000)));
Page output = operator.getOutput();
// 10000 expected rows, stddev=sqrt(10000)=100, so this is 10 stddevs.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public Map<String, String> apply(String s) {
}

@Override
protected Operator.OperatorFactory simple() {
protected Operator.OperatorFactory simple(SimpleOptions options) {
Supplier<Function<String, Map<String, String>>> expEval = () -> new FirstWord("test");
return new StringExtractOperator.StringExtractOperatorFactory(
new String[] { "test" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public class TopNOperatorTests extends OperatorTestCase {
);

@Override
protected TopNOperator.TopNOperatorFactory simple() {
protected TopNOperator.TopNOperatorFactory simple(SimpleOptions options) {
return new TopNOperator.TopNOperatorFactory(
4,
List.of(LONG),
Expand Down
Loading