**Build scan:**
https://gradle-enterprise.elastic.co/s/fvg2knbi424p4/tests/:x-pack:plugin:esql:test/org.elasticsearch.xpack.esql.expression.function.scalar.conditional.LeastTests/testEvaluateInManyThreads%20%7BTestCase=(%3Ckeyword%3E,%20%3Ckeyword%3E,%20%3Ckeyword%3E,%20%3Ckeyword%3E,%20%3Ckeyword%3E,%20%3Ckeyword%3E,%20%3Ckeyword%3E)%20null%20in%204%7D
**Reproduction lines:**
```
gradlew ':x-pack:plugin:esql:test' --tests "org.elasticsearch.xpack.esql.expression.function.scalar.conditional.GreatestTests.testEvaluateInManyThreads {TestCase=(<mv_integer>) null in 0}" -Dtests.seed=BCCD8A2AFCEA37CB -Dtests.locale=zh -Dtests.timezone=Europe/Guernsey -Druntime.java=21

gradlew ':x-pack:plugin:esql:test' --tests "org.elasticsearch.xpack.esql.expression.function.scalar.conditional.LeastTests.testEvaluateInManyThreads {TestCase=(<keyword>, <keyword>, <keyword>, <keyword>, <keyword>, <keyword>, <keyword>) null in 4}" -Dtests.seed=BCCD8A2AFCEA37CB -Dtests.locale=lt -Dtests.timezone=Indian/Christmas -Druntime.java=21

 gradlew ':x-pack:plugin:esql:test' --tests "org.elasticsearch.xpack.esql.expression.function.scalar.conditional.GreatestTests.testEvaluateInManyThreads {TestCase=(<mv_integer>) null in 0}" -Dtests.seed=BCCD8A2AFCEA37CB -Dtests.locale=zh -Dtests.timezone=Europe/Guernsey -Druntime.java=21
```

**Applicable branches:**
main

**Reproduces locally?:**
Yes

**Failure history:**
https://gradle-enterprise.elastic.co/scans/tests?tests.container=org.elasticsearch.xpack.esql.expression.function.scalar.conditional.LeastTests&tests.test=testEvaluateInManyThreads%20%7BTestCase%3D(%3Ckeyword%3E,%20%3Ckeyword%3E,%20%3Ckeyword%3E,%20%3Ckeyword%3E,%20%3Ckeyword%3E,%20%3Ckeyword%3E,%20%3Ckeyword%3E)%20null%20in%204%7D


**Failure excerpt:**
```
org.elasticsearch.xpack.esql.expression.function.scalar.conditional.GreatestTests > classMethod FAILED
    java.lang.AssertionError: expected:<[boolean, double, integer, ip, keyword, long, text, version]> but was:<[integer]>


```
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/AbstractFunctionTestCase.java
assertSimpleWithNulls(data, ref.block(), i);
                }
            }
        }
    }
    protected void assertSimpleWithNulls(List<Object> data, Block value, int nullBlock) {
        
        assertTrue("argument " + nullBlock + " is null", value.isNull(0));
    }
    public final void testEvaluateInManyThreads() throws ExecutionException, InterruptedException {
        assumeTrue("nothing to do if a type error", testCase.getExpectedTypeError() == null);
        assumeTrue("All test data types must be representable in order to build fields", testCase.allTypesAreRepresentable());
        int count = 10_000;
        int threads = 5;
        var evalSupplier = evaluator(buildFieldExpression(testCase));
        ExecutorService exec = Executors.newFixedThreadPool(threads);
        try {
            List<Future<?>> futures = new ArrayList<>();
            for (int i = 0; i < threads; i++) {
                List<Object> simpleData = testCase.getDataValues();
                Page page = row(simpleData);
                futures.add(exec.submit(() -> {
                    try (EvalOperator.ExpressionEvaluator eval = evalSupplier.get(driverContext())) {
                        for (int c = 0; c < count; c++) {
                            try (Block.Ref ref = eval.eval(page)) {
                                assertThat(toJavaObject(ref.block(), 0), testCase.getMatcher());
                            }
                        }
                    }
                }));