**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
}
    /**
     * Build the expected error message for an invalid type signature.
     */
    private static String typeErrorMessage(boolean includeOrdinal, List<Set<DataType>> validPerPosition, List<DataType> types) {
        int badArgPosition = -1;
        for (int i = 0; i < types.size(); i++) {
            if (validPerPosition.get(i).contains(types.get(i)) == false) {
                badArgPosition = i;
                break;
            }
        }
        if (badArgPosition == -1) {
            throw new IllegalStateException("can't find badArgPosition");
        }
        String ordinal = includeOrdinal ? TypeResolutions.ParamOrdinal.fromIndex(badArgPosition).name().toLowerCase(Locale.ROOT) + " " : "";
        String expectedType = expectedType(validPerPosition.get(badArgPosition));
        String name = types.get(badArgPosition).typeName();
        return ordinal + "argument of [] must be [" + expectedType + "], found value [" + name + "] type [" + name + "]";
    }
    private static final Map<Set<DataType>, String> NAMED_EXPECTED_TYPES = Map.ofEntries(
        Map.entry(Set.of(DataTypes.DOUBLE, DataTypes.NULL), "double"),
        Map.entry(Set.of(DataTypes.INTEGER, DataTypes.NULL), "integer"),
        Map.entry(Set.of(DataTypes.LONG, DataTypes.INTEGER, DataTypes.UNSIGNED_LONG, DataTypes.DOUBLE, DataTypes.NULL), "numeric"),
        Map.entry(Set.of(DataTypes.KEYWORD, DataTypes.TEXT, DataTypes.VERSION, DataTypes.NULL), "keyword, text or version"),
        Map.entry(Set.of(DataTypes.KEYWORD, DataTypes.TEXT, DataTypes.NULL), "string"),
        Map.entry(Set.of(DataTypes.IP, DataTypes.KEYWORD, DataTypes.NULL), "ip or keyword")
    );
    private static String expectedType(Set<DataType> validTypes) {
        String named = NAMED_EXPECTED_TYPES.get(validTypes);