diff --git a/muted-tests.yml b/muted-tests.yml index 317f0dbe6abc4..65d3417a2a6d3 100644 --- a/muted-tests.yml +++ b/muted-tests.yml @@ -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 diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/aggregation/AggregatorFunctionTestCase.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/aggregation/AggregatorFunctionTestCase.java index 3f47be19b22e1..ceb6978dc81e8 100644 --- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/aggregation/AggregatorFunctionTestCase.java +++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/aggregation/AggregatorFunctionTestCase.java @@ -61,7 +61,7 @@ protected final int aggregatorIntermediateBlockCount() { protected abstract void assertSimpleOutput(List input, Block result); @Override - protected Operator.OperatorFactory simpleWithMode(AggregatorMode mode) { + protected Operator.OperatorFactory simpleWithMode(SimpleOptions options, AggregatorMode mode) { return simpleWithMode(mode, Function.identity()); } diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/aggregation/GroupingAggregatorFunctionTestCase.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/aggregation/GroupingAggregatorFunctionTestCase.java index 9b8246be49799..d90a3ac827872 100644 --- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/aggregation/GroupingAggregatorFunctionTestCase.java +++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/aggregation/GroupingAggregatorFunctionTestCase.java @@ -90,8 +90,8 @@ 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 channels(AggregatorMode mode) { @@ -99,6 +99,7 @@ protected List channels(AggregatorMode mode) { } private Operator.OperatorFactory simpleWithMode( + SimpleOptions options, AggregatorMode mode, Function wrap ) { @@ -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 @@ -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)) ); @@ -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)) ); @@ -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()) ); diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/LuceneCountOperatorTests.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/LuceneCountOperatorTests.java index 4c97c78fdda95..bf0575821fbe6 100644 --- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/LuceneCountOperatorTests.java +++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/LuceneCountOperatorTests.java @@ -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); } diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/LuceneMaxOperatorTestCase.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/LuceneMaxOperatorTestCase.java index 5b3b0b6c63b2d..6275b3a07cacb 100644 --- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/LuceneMaxOperatorTestCase.java +++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/LuceneMaxOperatorTestCase.java @@ -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); } diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/LuceneMinOperatorTestCase.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/LuceneMinOperatorTestCase.java index 298701c4f7cd7..cf1620b309010 100644 --- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/LuceneMinOperatorTestCase.java +++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/LuceneMinOperatorTestCase.java @@ -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); } diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/LuceneSourceOperatorTests.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/LuceneSourceOperatorTests.java index 6aacf4a6c3bf1..a7de1ddf74ec2 100644 --- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/LuceneSourceOperatorTests.java +++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/LuceneSourceOperatorTests.java @@ -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); } diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/LuceneTopNSourceOperatorScoringTests.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/LuceneTopNSourceOperatorScoringTests.java index 786cbd76f2efd..9a558f69eb6ef 100644 --- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/LuceneTopNSourceOperatorScoringTests.java +++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/LuceneTopNSourceOperatorScoringTests.java @@ -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); } diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/LuceneTopNSourceOperatorTests.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/LuceneTopNSourceOperatorTests.java index 7a1ee32e7a42d..a43c37979a94e 100644 --- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/LuceneTopNSourceOperatorTests.java +++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/LuceneTopNSourceOperatorTests.java @@ -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); } diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/TimeSeriesSourceOperatorTests.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/TimeSeriesSourceOperatorTests.java index 4ab74eabd7463..4cb6dac14c151 100644 --- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/TimeSeriesSourceOperatorTests.java +++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/TimeSeriesSourceOperatorTests.java @@ -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 }); diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/ValueSourceReaderTypeConversionTests.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/ValueSourceReaderTypeConversionTests.java index 3778b6965b4f3..55c7b95d1edf0 100644 --- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/ValueSourceReaderTypeConversionTests.java +++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/ValueSourceReaderTypeConversionTests.java @@ -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); } diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/ValuesSourceReaderOperatorTests.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/ValuesSourceReaderOperatorTests.java index 60d160b67154a..a0fae75fd6200 100644 --- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/ValuesSourceReaderOperatorTests.java +++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/lucene/ValuesSourceReaderOperatorTests.java @@ -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 { diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/AggregationOperatorTests.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/AggregationOperatorTests.java index 6fbef583cbefa..2408e758ec697 100644 --- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/AggregationOperatorTests.java +++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/AggregationOperatorTests.java @@ -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 sumChannels, maxChannels; if (mode.isInputPartial()) { int sumInterChannelCount = SumLongAggregatorFunction.intermediateStateDesc().size(); diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/ChangePointOperatorTests.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/ChangePointOperatorTests.java index 3175bb06c5627..d3e68fc603cf9 100644 --- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/ChangePointOperatorTests.java +++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/ChangePointOperatorTests.java @@ -70,7 +70,7 @@ protected void assertSimpleOutput(List input, List results) { } @Override - protected Operator.OperatorFactory simple() { + protected Operator.OperatorFactory simple(SimpleOptions options) { return new ChangePointOperator.Factory(0, null, 0, 0); } diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/ColumnExtractOperatorTests.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/ColumnExtractOperatorTests.java index bd38967be7e34..f3bc02ffe5845 100644 --- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/ColumnExtractOperatorTests.java +++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/ColumnExtractOperatorTests.java @@ -48,7 +48,7 @@ public String toString() { } @Override - protected Operator.OperatorFactory simple() { + protected Operator.OperatorFactory simple(SimpleOptions options) { Supplier expEval = () -> new FirstWord(0); return new ColumnExtractOperator.Factory( new ElementType[] { ElementType.BYTES_REF }, diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/ColumnLoadOperatorTests.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/ColumnLoadOperatorTests.java index 3bcecda2ff9e5..2104fdcc42c6e 100644 --- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/ColumnLoadOperatorTests.java +++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/ColumnLoadOperatorTests.java @@ -64,7 +64,7 @@ protected void assertSimpleOutput(List input, List results) { } @Override - protected Operator.OperatorFactory simple() { + protected Operator.OperatorFactory simple(SimpleOptions options) { return new ColumnLoadOperator.Factory( new ColumnLoadOperator.Values( "values", diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/EvalOperatorTests.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/EvalOperatorTests.java index 85f4804653157..544541ef49d29 100644 --- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/EvalOperatorTests.java +++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/EvalOperatorTests.java @@ -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) { diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/FilterOperatorTests.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/FilterOperatorTests.java index ce85d9baa5c7d..a0de030bf4c97 100644 --- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/FilterOperatorTests.java +++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/FilterOperatorTests.java @@ -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 diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/ForkingOperatorTestCase.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/ForkingOperatorTestCase.java index 7d1471a0f3ebf..b48135c3f2bdd 100644 --- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/ForkingOperatorTestCase.java +++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/ForkingOperatorTestCase.java @@ -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() { diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/HashAggregationOperatorTests.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/HashAggregationOperatorTests.java index 30579f864abcb..0bacb36e00066 100644 --- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/HashAggregationOperatorTests.java +++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/HashAggregationOperatorTests.java @@ -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 sumChannels, maxChannels; if (mode.isInputPartial()) { int sumChannelCount = SumLongAggregatorFunction.intermediateStateDesc().size(); diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/IteratorAppendPageTests.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/IteratorAppendPageTests.java index e9d9ce7c70fdf..a355e3021d8bf 100644 --- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/IteratorAppendPageTests.java +++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/IteratorAppendPageTests.java @@ -103,7 +103,7 @@ protected void assertSimpleOutput(List input, List results) { } @Override - protected Operator.OperatorFactory simple() { + protected Operator.OperatorFactory simple(SimpleOptions options) { return new IteratorAppendPage.Factory(); } diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/IteratorRemovePageTests.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/IteratorRemovePageTests.java index c682a2960b380..77b2120002d92 100644 --- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/IteratorRemovePageTests.java +++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/IteratorRemovePageTests.java @@ -105,7 +105,7 @@ protected void assertSimpleOutput(List input, List results) { } @Override - protected Operator.OperatorFactory simple() { + protected Operator.OperatorFactory simple(SimpleOptions options) { return new IteratorRemovePage.Factory(); } diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/LimitOperatorTests.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/LimitOperatorTests.java index bf0e01bc59618..8740ec8135783 100644 --- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/LimitOperatorTests.java +++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/LimitOperatorTests.java @@ -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); } @@ -55,7 +55,7 @@ protected void assertSimpleOutput(List input, List 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)); @@ -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); diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/MvExpandOperatorTests.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/MvExpandOperatorTests.java index d6abdac383e5c..cd88356a0d3eb 100644 --- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/MvExpandOperatorTests.java +++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/MvExpandOperatorTests.java @@ -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)); } diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/OutputOperatorTests.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/OutputOperatorTests.java index 8a6e890afde2b..8947f7ca5aded 100644 --- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/OutputOperatorTests.java +++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/OutputOperatorTests.java @@ -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 -> {}); } diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/ProjectOperatorTests.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/ProjectOperatorTests.java index 12b22a6244ae3..de32b51f93edb 100644 --- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/ProjectOperatorTests.java +++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/ProjectOperatorTests.java @@ -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)); } diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/RowInTableLookupOperatorTests.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/RowInTableLookupOperatorTests.java index 7522f57a3a9ee..63f8239073c2a 100644 --- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/RowInTableLookupOperatorTests.java +++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/RowInTableLookupOperatorTests.java @@ -79,7 +79,7 @@ private void assertSimpleOutput(List input, List results, int keyCha } @Override - protected Operator.OperatorFactory simple() { + protected Operator.OperatorFactory simple(SimpleOptions options) { return new RowInTableLookupOperator.Factory( new RowInTableLookupOperator.Key[] { new RowInTableLookupOperator.Key( diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/SampleOperatorTests.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/SampleOperatorTests.java index cf2d73ab4768f..c66c48d2af783 100644 --- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/SampleOperatorTests.java +++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/SampleOperatorTests.java @@ -40,7 +40,7 @@ protected void assertSimpleOutput(List input, List results) { } @Override - protected SampleOperator.Factory simple() { + protected SampleOperator.Factory simple(SimpleOptions options) { return new SampleOperator.Factory(0.5, randomInt()); } @@ -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. diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/StringExtractOperatorTests.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/StringExtractOperatorTests.java index 09105774388a2..382cfc93bfabf 100644 --- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/StringExtractOperatorTests.java +++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/StringExtractOperatorTests.java @@ -41,7 +41,7 @@ public Map apply(String s) { } @Override - protected Operator.OperatorFactory simple() { + protected Operator.OperatorFactory simple(SimpleOptions options) { Supplier>> expEval = () -> new FirstWord("test"); return new StringExtractOperator.StringExtractOperatorFactory( new String[] { "test" }, diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/topn/TopNOperatorTests.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/topn/TopNOperatorTests.java index bf2f3d2b97dd7..8561ce84744aa 100644 --- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/topn/TopNOperatorTests.java +++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/topn/TopNOperatorTests.java @@ -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), diff --git a/x-pack/plugin/esql/compute/test/src/main/java/org/elasticsearch/compute/test/AnyOperatorTestCase.java b/x-pack/plugin/esql/compute/test/src/main/java/org/elasticsearch/compute/test/AnyOperatorTestCase.java index 226fb67fdc188..04c2323116ab7 100644 --- a/x-pack/plugin/esql/compute/test/src/main/java/org/elasticsearch/compute/test/AnyOperatorTestCase.java +++ b/x-pack/plugin/esql/compute/test/src/main/java/org/elasticsearch/compute/test/AnyOperatorTestCase.java @@ -32,11 +32,27 @@ * Superclass for testing any {@link Operator}, including {@link SourceOperator}s. */ public abstract class AnyOperatorTestCase extends ComputeTestCase { + /** + * @param requiresDeterministicFactory + * True if the returned {@link Operator.OperatorFactory} should always generate an identical deterministic operator. + * That is, for two different calls, both operators should do "exactly" the same. + */ + protected record SimpleOptions(boolean requiresDeterministicFactory) { + public static final SimpleOptions DEFAULT = new SimpleOptions(false); + } + /** * The operator configured a "simple" or basic way, used for smoke testing * descriptions, {@link CircuitBreaker}s, and scatter/gather. */ - protected abstract Operator.OperatorFactory simple(); + protected abstract Operator.OperatorFactory simple(SimpleOptions options); + + /** + * Calls {@link #simple(SimpleOptions)} with the default options. + */ + protected final Operator.OperatorFactory simple() { + return simple(SimpleOptions.DEFAULT); + } /** * The description of the operator produced by {@link #simple}. diff --git a/x-pack/plugin/esql/compute/test/src/main/java/org/elasticsearch/compute/test/OperatorTestCase.java b/x-pack/plugin/esql/compute/test/src/main/java/org/elasticsearch/compute/test/OperatorTestCase.java index 0fad56dc99b83..698ae339060db 100644 --- a/x-pack/plugin/esql/compute/test/src/main/java/org/elasticsearch/compute/test/OperatorTestCase.java +++ b/x-pack/plugin/esql/compute/test/src/main/java/org/elasticsearch/compute/test/OperatorTestCase.java @@ -98,7 +98,7 @@ protected ByteSizeValue enoughMemoryForSimple() { */ public final void testSimpleCircuitBreaking() { ByteSizeValue memoryLimitForSimple = enoughMemoryForSimple(); - Operator.OperatorFactory simple = simple(); + Operator.OperatorFactory simple = simple(new SimpleOptions(true)); DriverContext inputFactoryContext = driverContext(); List input = CannedSourceOperator.collectPages(simpleInput(inputFactoryContext.blockFactory(), between(1_000, 10_000))); try { diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/enrich/LookupFromIndexOperatorTests.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/enrich/LookupFromIndexOperatorTests.java index 87f200da44441..5a9ea4f09ea92 100644 --- a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/enrich/LookupFromIndexOperatorTests.java +++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/enrich/LookupFromIndexOperatorTests.java @@ -123,7 +123,7 @@ protected void assertSimpleOutput(List input, List results) { } @Override - protected Operator.OperatorFactory simple() { + protected Operator.OperatorFactory simple(SimpleOptions options) { String sessionId = "test"; CancellableTask parentTask = new CancellableTask(0, "test", "test", "test", TaskId.EMPTY_TASK_ID, Map.of()); int maxOutstandingRequests = 1; diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/inference/RerankOperatorTests.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/inference/RerankOperatorTests.java index 2833f3fab0d7a..c24602cd74d9b 100644 --- a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/inference/RerankOperatorTests.java +++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/inference/RerankOperatorTests.java @@ -88,7 +88,7 @@ public void shutdownThreadPool() { } @Override - protected Operator.OperatorFactory simple() { + protected Operator.OperatorFactory simple(SimpleOptions options) { InferenceRunner inferenceRunner = mockedSimpleInferenceRunner(); return new RerankOperator.Factory(inferenceRunner, SIMPLE_INFERENCE_ID, SIMPLE_QUERY, rowEncoderFactory, scoreChannel); }