diff --git a/docs/reference/esql/functions/kibana/definition/mv_sort.json b/docs/reference/esql/functions/kibana/definition/mv_sort.json index 3abedbf752943..072c05743af33 100644 --- a/docs/reference/esql/functions/kibana/definition/mv_sort.json +++ b/docs/reference/esql/functions/kibana/definition/mv_sort.json @@ -22,24 +22,6 @@ "variadic" : false, "returnType" : "boolean" }, - { - "params" : [ - { - "name" : "field", - "type" : "boolean", - "optional" : false, - "description" : "Multivalue expression. If `null`, the function returns `null`." - }, - { - "name" : "order", - "type" : "text", - "optional" : true, - "description" : "Sort order. The valid options are ASC and DESC, the default is ASC." - } - ], - "variadic" : false, - "returnType" : "boolean" - }, { "params" : [ { @@ -58,24 +40,6 @@ "variadic" : false, "returnType" : "date" }, - { - "params" : [ - { - "name" : "field", - "type" : "date", - "optional" : false, - "description" : "Multivalue expression. If `null`, the function returns `null`." - }, - { - "name" : "order", - "type" : "text", - "optional" : true, - "description" : "Sort order. The valid options are ASC and DESC, the default is ASC." - } - ], - "variadic" : false, - "returnType" : "date" - }, { "params" : [ { @@ -94,24 +58,6 @@ "variadic" : false, "returnType" : "date_nanos" }, - { - "params" : [ - { - "name" : "field", - "type" : "date_nanos", - "optional" : false, - "description" : "Multivalue expression. If `null`, the function returns `null`." - }, - { - "name" : "order", - "type" : "text", - "optional" : true, - "description" : "Sort order. The valid options are ASC and DESC, the default is ASC." - } - ], - "variadic" : false, - "returnType" : "date_nanos" - }, { "params" : [ { @@ -130,24 +76,6 @@ "variadic" : false, "returnType" : "double" }, - { - "params" : [ - { - "name" : "field", - "type" : "double", - "optional" : false, - "description" : "Multivalue expression. If `null`, the function returns `null`." - }, - { - "name" : "order", - "type" : "text", - "optional" : true, - "description" : "Sort order. The valid options are ASC and DESC, the default is ASC." - } - ], - "variadic" : false, - "returnType" : "double" - }, { "params" : [ { @@ -166,24 +94,6 @@ "variadic" : false, "returnType" : "integer" }, - { - "params" : [ - { - "name" : "field", - "type" : "integer", - "optional" : false, - "description" : "Multivalue expression. If `null`, the function returns `null`." - }, - { - "name" : "order", - "type" : "text", - "optional" : true, - "description" : "Sort order. The valid options are ASC and DESC, the default is ASC." - } - ], - "variadic" : false, - "returnType" : "integer" - }, { "params" : [ { @@ -202,24 +112,6 @@ "variadic" : false, "returnType" : "ip" }, - { - "params" : [ - { - "name" : "field", - "type" : "ip", - "optional" : false, - "description" : "Multivalue expression. If `null`, the function returns `null`." - }, - { - "name" : "order", - "type" : "text", - "optional" : true, - "description" : "Sort order. The valid options are ASC and DESC, the default is ASC." - } - ], - "variadic" : false, - "returnType" : "ip" - }, { "params" : [ { @@ -238,24 +130,6 @@ "variadic" : false, "returnType" : "keyword" }, - { - "params" : [ - { - "name" : "field", - "type" : "keyword", - "optional" : false, - "description" : "Multivalue expression. If `null`, the function returns `null`." - }, - { - "name" : "order", - "type" : "text", - "optional" : true, - "description" : "Sort order. The valid options are ASC and DESC, the default is ASC." - } - ], - "variadic" : false, - "returnType" : "keyword" - }, { "params" : [ { @@ -274,24 +148,6 @@ "variadic" : false, "returnType" : "long" }, - { - "params" : [ - { - "name" : "field", - "type" : "long", - "optional" : false, - "description" : "Multivalue expression. If `null`, the function returns `null`." - }, - { - "name" : "order", - "type" : "text", - "optional" : true, - "description" : "Sort order. The valid options are ASC and DESC, the default is ASC." - } - ], - "variadic" : false, - "returnType" : "long" - }, { "params" : [ { @@ -310,24 +166,6 @@ "variadic" : false, "returnType" : "keyword" }, - { - "params" : [ - { - "name" : "field", - "type" : "text", - "optional" : false, - "description" : "Multivalue expression. If `null`, the function returns `null`." - }, - { - "name" : "order", - "type" : "text", - "optional" : true, - "description" : "Sort order. The valid options are ASC and DESC, the default is ASC." - } - ], - "variadic" : false, - "returnType" : "keyword" - }, { "params" : [ { @@ -345,24 +183,6 @@ ], "variadic" : false, "returnType" : "version" - }, - { - "params" : [ - { - "name" : "field", - "type" : "version", - "optional" : false, - "description" : "Multivalue expression. If `null`, the function returns `null`." - }, - { - "name" : "order", - "type" : "text", - "optional" : true, - "description" : "Sort order. The valid options are ASC and DESC, the default is ASC." - } - ], - "variadic" : false, - "returnType" : "version" } ], "examples" : [ diff --git a/docs/reference/esql/functions/types/mv_sort.asciidoc b/docs/reference/esql/functions/types/mv_sort.asciidoc index 97abe60c0ceab..83d3e45c7be02 100644 --- a/docs/reference/esql/functions/types/mv_sort.asciidoc +++ b/docs/reference/esql/functions/types/mv_sort.asciidoc @@ -6,23 +6,13 @@ |=== field | order | result boolean | keyword | boolean -boolean | text | boolean date | keyword | date -date | text | date date_nanos | keyword | date_nanos -date_nanos | text | date_nanos double | keyword | double -double | text | double integer | keyword | integer -integer | text | integer ip | keyword | ip -ip | text | ip keyword | keyword | keyword -keyword | text | keyword long | keyword | long -long | text | long text | keyword | keyword -text | text | keyword version | keyword | version -version | text | version |=== diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/AbstractScalarFunctionTestCase.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/AbstractScalarFunctionTestCase.java index 0a6a7050518cc..cc18a76e9a2f7 100644 --- a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/AbstractScalarFunctionTestCase.java +++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/AbstractScalarFunctionTestCase.java @@ -108,9 +108,15 @@ protected static Iterable parameterSuppliersFromTypedDataWithDefaultCh protected static Iterable parameterSuppliersFromTypedDataWithDefaultChecks( ExpectedType nullsExpectedType, ExpectedEvaluatorToString evaluatorToString, - List suppliers + List suppliers, + PositionalErrorMessageSupplier positionalErrorMessageSupplier ) { - return parameterSuppliersFromTypedData(anyNullIsNull(randomizeBytesRefsOffset(suppliers), nullsExpectedType, evaluatorToString)); + return parameterSuppliersFromTypedData( + errorsForCasesWithoutExamples( + anyNullIsNull(randomizeBytesRefsOffset(suppliers), nullsExpectedType, evaluatorToString), + positionalErrorMessageSupplier + ) + ); } public final void testEvaluate() { diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvPercentileErrorTests.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvPercentileErrorTests.java deleted file mode 100644 index 25e7100b7c418..0000000000000 --- a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvPercentileErrorTests.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -package org.elasticsearch.xpack.esql.expression.function.scalar.multivalue; - -import org.elasticsearch.xpack.esql.core.expression.Expression; -import org.elasticsearch.xpack.esql.core.tree.Source; -import org.elasticsearch.xpack.esql.core.type.DataType; -import org.elasticsearch.xpack.esql.expression.function.ErrorsForCasesWithoutExamplesTestCase; -import org.elasticsearch.xpack.esql.expression.function.TestCaseSupplier; -import org.hamcrest.Matcher; - -import java.util.List; -import java.util.Set; - -import static org.hamcrest.Matchers.equalTo; - -public class MvPercentileErrorTests extends ErrorsForCasesWithoutExamplesTestCase { - @Override - protected List cases() { - return paramsToSuppliers(MvPercentileTests.parameters()); - } - - @Override - protected Expression build(Source source, List args) { - return new MvPercentile(source, args.get(0), args.get(1)); - } - - @Override - protected Matcher expectedTypeErrorMatcher(List> validPerPosition, List signature) { - return equalTo(typeErrorMessage(true, validPerPosition, signature, (v, p) -> "numeric except unsigned_long")); - } -} diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvPercentileTests.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvPercentileTests.java index 31bba744c16ef..0a419d44e3448 100644 --- a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvPercentileTests.java +++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvPercentileTests.java @@ -357,7 +357,8 @@ public static Iterable parameters() { ? DataType.NULL : original.expectedType(), (nullPosition, nullData, original) -> original, - cases + cases, + (v, p) -> "numeric except unsigned_long" ); }