**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
List<Object[]> parameters = new ArrayList<>(cases.size());
        for (TestCaseSupplier element : cases) {
            parameters.add(new Object[] { element });
        }
        return parameters;
    }
    protected static FieldAttribute field(String name, DataType type) {
        return new FieldAttribute(Source.EMPTY, name, new EsField(name, type, Map.of(), true));
    }
    protected static Expression deepCopyOfField(String name, DataType type) {
        return new DeepCopy(Source.EMPTY, new FieldAttribute(Source.EMPTY, name, new EsField(name, type, Map.of(), true)));
    }
    /**
     * Build the expression being tested, for the given source and list of arguments.  Test classes need to implement this
     * to have something to test.
     * @param source the source
     * @param args arg list from the test case, should match the length expected
     * @return an expression for evaluating the function being tested on the given arguments
     */
    protected abstract Expression build(Source source, List<Expression> args);
    protected final Expression buildFieldExpression(TestCaseSupplier.TestCase testCase) {
        return build(testCase.getSource(), testCase.getDataAsFields());
    }
    protected final Expression buildDeepCopyOfFieldExpression(TestCaseSupplier.TestCase testCase) {
        return build(testCase.getSource(), testCase.getDataAsDeepCopiedFields());
    }
    protected final Expression buildLiteralExpression(TestCaseSupplier.TestCase testCase) {
        return build(testCase.getSource(), testCase.getDataAsLiterals());
    }