Browse Source

Parameterized testing follow up (ESQL-1540)

Addresses a few follow ups from
https://github.com/elastic/elasticsearch-internal/pull/1497.
Specifically, drops the need to specify `Source` on all test cases
(instead setting `Source.EMPTY` always, which in practice was what we
were doing anyway) and moving the expected return type into the test
case.

It does not remove the abstract method for checking the return type,
since that requires some further changes in other looping tests.
Addressing those will be the next PR.
Mark Tozzi 2 years ago
parent
commit
245d86e484
53 changed files with 78 additions and 71 deletions
  1. 9 2
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/AbstractFunctionTestCase.java
  2. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/conditional/CaseTests.java
  3. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/conditional/IsNotNullTests.java
  4. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/conditional/IsNullTests.java
  5. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/date/DateExtractTests.java
  6. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/date/DateParseTests.java
  7. 4 4
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/AbsTests.java
  8. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/AcosTests.java
  9. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/AsinTests.java
  10. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/Atan2Tests.java
  11. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/AtanTests.java
  12. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/AutoBucketTests.java
  13. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/CosTests.java
  14. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/CoshTests.java
  15. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/ETests.java
  16. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/FloorTests.java
  17. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/IsFiniteTests.java
  18. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/IsInfiniteTests.java
  19. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/IsNaNTests.java
  20. 2 3
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/Log10Tests.java
  21. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/PiTests.java
  22. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/PowTests.java
  23. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/RoundTests.java
  24. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/SinTests.java
  25. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/SinhTests.java
  26. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/TanTests.java
  27. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/TanhTests.java
  28. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/TauTests.java
  29. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvAvgTests.java
  30. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvConcatTests.java
  31. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvCountTests.java
  32. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvDedupeTests.java
  33. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvMaxTests.java
  34. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvMedianTests.java
  35. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvMinTests.java
  36. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvSumTests.java
  37. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/ConcatTests.java
  38. 2 2
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/LengthTests.java
  39. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/SplitTests.java
  40. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/StartsWithTests.java
  41. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/SubstringTests.java
  42. 3 2
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/TrimTests.java
  43. 3 3
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/predicate/operator/arithmetic/AddTests.java
  44. 3 3
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/predicate/operator/arithmetic/DivTests.java
  45. 3 3
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/predicate/operator/arithmetic/ModTests.java
  46. 3 3
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/predicate/operator/arithmetic/MulTests.java
  47. 3 3
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/predicate/operator/arithmetic/SubTests.java
  48. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/predicate/operator/comparison/EqualsTests.java
  49. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/predicate/operator/comparison/GreaterThanOrEqualTests.java
  50. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/predicate/operator/comparison/GreaterThanTests.java
  51. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/predicate/operator/comparison/LessThanOrEqualTests.java
  52. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/predicate/operator/comparison/LessThanTests.java
  53. 1 1
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/predicate/operator/comparison/NotEqualsTests.java

+ 9 - 2
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/AbstractFunctionTestCase.java

@@ -74,15 +74,20 @@ public abstract class AbstractFunctionTestCase extends ESTestCase {
          * The expected toString output for the evaluator this fuction invocation should generate
          */
         String evaluatorToString;
+        /**
+         * The expected output type for the case being tested
+         */
+        DataType exptectedType;
         /**
          * A matcher to validate the output of the function run on the given input data
          */
         private Matcher<Object> matcher;
 
-        public TestCase(Source source, List<TypedData> data, String evaluatorToString, Matcher<Object> matcher) {
-            this.source = source;
+        public TestCase(List<TypedData> data, String evaluatorToString, DataType expectedType, Matcher<Object> matcher) {
+            this.source = Source.EMPTY;
             this.data = data;
             this.evaluatorToString = evaluatorToString;
+            this.exptectedType = expectedType;
             this.matcher = matcher;
         }
 
@@ -223,6 +228,7 @@ public abstract class AbstractFunctionTestCase extends ESTestCase {
 
     public final void testSimple() {
         Expression expression = buildFieldExpression(testCase);
+        assertThat(expression.dataType(), equalTo(testCase.exptectedType));
         Object result = toJavaObject(evaluator(expression).get().eval(row(testCase.getDataValues())), 0);
         assertThat(result, testCase.getMatcher());
     }
@@ -283,6 +289,7 @@ public abstract class AbstractFunctionTestCase extends ESTestCase {
 
     public final void testSimpleConstantFolding() {
         Expression e = buildLiteralExpression(testCase);
+        assertThat(e.dataType(), equalTo(testCase.exptectedType));
         assertTrue(e.foldable());
         assertThat(e.fold(), testCase.getMatcher());
     }

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/conditional/CaseTests.java

@@ -49,10 +49,10 @@ public class CaseTests extends AbstractFunctionTestCase {
                 new TypedData(new BytesRef("b"), DataTypes.KEYWORD, "b")
             );
             return new TestCase(
-                Source.EMPTY,
                 typedData,
                 "CaseEvaluator[resultType=BYTES_REF, conditions=[ConditionEvaluator[condition=Attribute[channel=0], "
                     + "value=Attribute[channel=1]]], elseVal=Attribute[channel=2]]",
+                DataTypes.KEYWORD,
                 equalTo(new BytesRef("a"))
             );
         })));

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/conditional/IsNotNullTests.java

@@ -36,9 +36,9 @@ public class IsNotNullTests extends AbstractScalarFunctionTestCase {
     public static Iterable<Object[]> parameters() {
         return parameterSuppliersFromTypedData(List.of(new TestCaseSupplier("Keyword Not Null", () -> {
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(new BytesRef("cat"), DataTypes.KEYWORD, "exp")),
                 "IsNotNullEvaluator[field=Attribute[channel=0]]",
+                DataTypes.BOOLEAN,
                 equalTo(true)
             );
         })));

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/conditional/IsNullTests.java

@@ -36,9 +36,9 @@ public class IsNullTests extends AbstractScalarFunctionTestCase {
     public static Iterable<Object[]> parameters() {
         return parameterSuppliersFromTypedData(List.of(new TestCaseSupplier("Keyword is Null", () -> {
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(new BytesRef("cat"), DataTypes.KEYWORD, "exp")),
                 "IsNullEvaluator[field=Attribute[channel=0]]",
+                DataTypes.BOOLEAN,
                 equalTo(false)
             );
         })));

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/date/DateExtractTests.java

@@ -37,12 +37,12 @@ public class DateExtractTests extends AbstractScalarFunctionTestCase {
     public static Iterable<Object[]> parameters() {
         return parameterSuppliersFromTypedData(List.of(new TestCaseSupplier("Date Extract Year", () -> {
             return new TestCase(
-                Source.EMPTY,
                 List.of(
                     new TypedData(1687944333000L, DataTypes.DATETIME, "date"),
                     new TypedData(new BytesRef("YEAR"), DataTypes.KEYWORD, "field")
                 ),
                 "DateExtractEvaluator[value=Attribute[channel=0], chronoField=Attribute[channel=1], zone=Z]",
+                DataTypes.LONG,
                 equalTo(2023L)
             );
         })));

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/date/DateParseTests.java

@@ -31,12 +31,12 @@ public class DateParseTests extends AbstractScalarFunctionTestCase {
     public static Iterable<Object[]> parameters() {
         return parameterSuppliersFromTypedData(List.of(new TestCaseSupplier("Basic Case", () -> {
             return new TestCase(
-                Source.EMPTY,
                 List.of(
                     new TypedData(new BytesRef("2023-05-05"), DataTypes.KEYWORD, "first"),
                     new TypedData(new BytesRef("yyyy-MM-dd"), DataTypes.KEYWORD, "second")
                 ),
                 "DateParseEvaluator[val=Attribute[channel=0], formatter=Attribute[channel=1], zoneId=Z]",
+                DataTypes.DATETIME,
                 equalTo(1683244800000L)
             );
         })));

+ 4 - 4
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/AbsTests.java

@@ -27,33 +27,33 @@ public class AbsTests extends AbstractScalarFunctionTestCase {
         return parameterSuppliersFromTypedData(List.of(new TestCaseSupplier("Integer", () -> {
             int arg = randomInt();
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(arg, DataTypes.INTEGER, "arg")),
                 "AbsIntEvaluator[fieldVal=Attribute[channel=0]]",
+                DataTypes.INTEGER,
                 equalTo(Math.abs(arg))
             );
         }), new TestCaseSupplier("UnsignedLong", () -> {
             long arg = randomLong();
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(arg, DataTypes.UNSIGNED_LONG, "arg")),
                 "Attribute[channel=0]",
+                DataTypes.UNSIGNED_LONG,
                 equalTo(arg)
             );
         }), new TestCaseSupplier("Long", () -> {
             long arg = randomLong();
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(arg, DataTypes.LONG, "arg")),
                 "AbsLongEvaluator[fieldVal=Attribute[channel=0]]",
+                DataTypes.LONG,
                 equalTo(Math.abs(arg))
             );
         }), new TestCaseSupplier("Double", () -> {
             double arg = randomDouble();
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(arg, DataTypes.DOUBLE, "arg")),
                 "AbsDoubleEvaluator[fieldVal=Attribute[channel=0]]",
+                DataTypes.DOUBLE,
                 equalTo(Math.abs(arg))
             );
         })));

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/AcosTests.java

@@ -31,9 +31,9 @@ public class AcosTests extends AbstractScalarFunctionTestCase {
         return parameterSuppliersFromTypedData(List.of(new TestCaseSupplier("double", () -> {
             double arg = randomDouble();
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(arg, DataTypes.DOUBLE, "arg")),
                 "AcosEvaluator[val=Attribute[channel=0]]",
+                DataTypes.DOUBLE,
                 equalTo(Math.acos(arg))
             );
         })));

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/AsinTests.java

@@ -31,9 +31,9 @@ public class AsinTests extends AbstractScalarFunctionTestCase {
         return parameterSuppliersFromTypedData(List.of(new TestCaseSupplier("double", () -> {
             double arg = randomDouble();
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(arg, DataTypes.DOUBLE, "arg")),
                 "AsinEvaluator[val=Attribute[channel=0]]",
+                DataTypes.DOUBLE,
                 equalTo(Math.asin(arg))
             );
         })));

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/Atan2Tests.java

@@ -32,9 +32,9 @@ public class Atan2Tests extends AbstractScalarFunctionTestCase {
             double y = randomDoubleBetween(Double.MIN_VALUE, Double.MAX_VALUE, true);
             double x = randomDoubleBetween(Double.MIN_VALUE, Double.MAX_VALUE, true);
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(y, DataTypes.DOUBLE, "y"), new TypedData(x, DataTypes.DOUBLE, "x")),
                 "Atan2Evaluator[y=Attribute[channel=0], x=Attribute[channel=1]]",
+                DataTypes.DOUBLE,
                 equalTo(Math.atan2(y, x))
             );
         })));

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/AtanTests.java

@@ -31,9 +31,9 @@ public class AtanTests extends AbstractScalarFunctionTestCase {
         return parameterSuppliersFromTypedData(List.of(new TestCaseSupplier("double", () -> {
             double arg = randomDoubleBetween(Double.MIN_VALUE, Double.MAX_VALUE, true);
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(arg, DataTypes.DOUBLE, "arg")),
                 "AtanEvaluator[val=Attribute[channel=0]]",
+                DataTypes.DOUBLE,
                 equalTo(Math.atan(arg))
             );
         })));

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/AutoBucketTests.java

@@ -38,9 +38,9 @@ public class AutoBucketTests extends AbstractScalarFunctionTestCase {
                 new TypedData(DateFieldMapper.DEFAULT_DATE_TIME_FORMATTER.parseMillis("2023-02-17T09:00:00.00Z"), DataTypes.DATETIME, "arg")
             );
             return new TestCase(
-                Source.EMPTY,
                 args,
                 "DateTruncEvaluator[fieldVal=Attribute[channel=0], rounding=Rounding[DAY_OF_MONTH in Z][fixed to midnight]]",
+                DataTypes.DATETIME,
                 resultsMatcher(args)
             );
         })));

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/CosTests.java

@@ -31,9 +31,9 @@ public class CosTests extends AbstractScalarFunctionTestCase {
         return parameterSuppliersFromTypedData(List.of(new TestCaseSupplier("large double value", () -> {
             double arg = 1 / randomDouble();
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(arg, DataTypes.DOUBLE, "arg")),
                 "CosEvaluator[val=Attribute[channel=0]]",
+                DataTypes.DOUBLE,
                 equalTo(Math.cos(arg))
             );
         })));

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/CoshTests.java

@@ -31,9 +31,9 @@ public class CoshTests extends AbstractScalarFunctionTestCase {
         return parameterSuppliersFromTypedData(List.of(new TestCaseSupplier("large double value", () -> {
             double arg = 1 / randomDouble();
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(arg, DataTypes.DOUBLE, "arg")),
                 "CoshEvaluator[val=Attribute[channel=0]]",
+                DataTypes.DOUBLE,
                 equalTo(Math.cosh(arg))
             );
         })));

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/ETests.java

@@ -32,9 +32,9 @@ public class ETests extends AbstractScalarFunctionTestCase {
     public static Iterable<Object[]> parameters() {
         return parameterSuppliersFromTypedData(List.of(new TestCaseSupplier("E Test", () -> {
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(1, DataTypes.INTEGER, "foo")),
                 "LiteralsEvaluator[block=2.718281828459045]",
+                DataTypes.DOUBLE,
                 equalTo(Math.E)
             );
         })));

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/FloorTests.java

@@ -31,9 +31,9 @@ public class FloorTests extends AbstractScalarFunctionTestCase {
         return parameterSuppliersFromTypedData(List.of(new TestCaseSupplier("large double value", () -> {
             double arg = 1 / randomDouble();
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(arg, DataTypes.DOUBLE, "arg")),
                 "FloorDoubleEvaluator[val=Attribute[channel=0]]",
+                DataTypes.DOUBLE,
                 equalTo(Math.floor(arg))
             );
         })));

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/IsFiniteTests.java

@@ -42,9 +42,9 @@ public class IsFiniteTests extends AbstractRationalUnaryPredicateTests {
 
     private static TestCase makeTestCase(double val, boolean expected) {
         return new TestCase(
-            Source.EMPTY,
             List.of(new TypedData(val, DataTypes.DOUBLE, "arg")),
             "IsFiniteEvaluator[val=Attribute[channel=0]]",
+            DataTypes.BOOLEAN,
             equalTo(expected)
         );
     }

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/IsInfiniteTests.java

@@ -42,9 +42,9 @@ public class IsInfiniteTests extends AbstractRationalUnaryPredicateTests {
 
     private static TestCase makeTestCase(double val, boolean expected) {
         return new TestCase(
-            Source.EMPTY,
             List.of(new TypedData(val, DataTypes.DOUBLE, "arg")),
             "IsInfiniteEvaluator[val=Attribute[channel=0]]",
+            DataTypes.BOOLEAN,
             equalTo(expected)
         );
     }

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/IsNaNTests.java

@@ -43,9 +43,9 @@ public class IsNaNTests extends AbstractRationalUnaryPredicateTests {
 
     private static TestCase makeTestCase(double val, boolean expected) {
         return new TestCase(
-            Source.EMPTY,
             List.of(new TypedData(val, DataTypes.DOUBLE, "arg")),
             "IsNaNEvaluator[val=Attribute[channel=0]]",
+            DataTypes.BOOLEAN,
             equalTo(expected)
         );
     }

+ 2 - 3
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/Log10Tests.java

@@ -20,7 +20,6 @@ import org.hamcrest.Matcher;
 import java.util.List;
 import java.util.function.Supplier;
 
-import static org.elasticsearch.xpack.ql.type.DataTypes.DOUBLE;
 import static org.hamcrest.Matchers.equalTo;
 
 public class Log10Tests extends AbstractScalarFunctionTestCase {
@@ -34,9 +33,9 @@ public class Log10Tests extends AbstractScalarFunctionTestCase {
             // TODO: include larger values here
             double arg = randomDouble();
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(arg, DataTypes.DOUBLE, "arg")),
                 "Log10DoubleEvaluator[val=Attribute[channel=0]]",
+                DataTypes.DOUBLE,
                 equalTo(Math.log10(arg))
             );
         })));
@@ -58,6 +57,6 @@ public class Log10Tests extends AbstractScalarFunctionTestCase {
 
     @Override
     protected DataType expectedType(List<DataType> argTypes) {
-        return DOUBLE;
+        return DataTypes.DOUBLE;
     }
 }

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/PiTests.java

@@ -32,9 +32,9 @@ public class PiTests extends AbstractScalarFunctionTestCase {
     public static Iterable<Object[]> parameters() {
         return parameterSuppliersFromTypedData(List.of(new TestCaseSupplier("Pi Test", () -> {
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(1, DataTypes.INTEGER, "foo")),
                 "LiteralsEvaluator[block=3.141592653589793]",
+                DataTypes.DOUBLE,
                 equalTo(Math.PI)
             );
         })));

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/PowTests.java

@@ -34,9 +34,9 @@ public class PowTests extends AbstractScalarFunctionTestCase {
             double base = 1 / randomDouble();
             int exponent = between(-30, 30);
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(base, DataTypes.DOUBLE, "arg"), new TypedData(exponent, DataTypes.INTEGER, "exp")),
                 "PowDoubleEvaluator[base=Attribute[channel=0], exponent=CastIntToDoubleEvaluator[v=Attribute[channel=1]]]",
+                DataTypes.DOUBLE,
                 equalTo(Math.pow(base, exponent))
             );
         })));

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/RoundTests.java

@@ -34,9 +34,9 @@ public class RoundTests extends AbstractScalarFunctionTestCase {
             double number = 1 / randomDouble();
             int precision = between(-30, 30);
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(number, DataTypes.DOUBLE, "number"), new TypedData(precision, DataTypes.INTEGER, "precision")),
                 "RoundDoubleEvaluator[val=Attribute[channel=0], decimals=CastIntToLongEvaluator[v=Attribute[channel=1]]]",
+                DataTypes.DOUBLE,
                 equalTo(Maths.round(number, precision))
             );
         })));

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/SinTests.java

@@ -31,9 +31,9 @@ public class SinTests extends AbstractScalarFunctionTestCase {
         return parameterSuppliersFromTypedData(List.of(new TestCaseSupplier("large double value", () -> {
             double arg = 1 / randomDouble();
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(arg, DataTypes.DOUBLE, "arg")),
                 "SinEvaluator[val=Attribute[channel=0]]",
+                DataTypes.DOUBLE,
                 equalTo(Math.sin(arg))
             );
         })));

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/SinhTests.java

@@ -31,9 +31,9 @@ public class SinhTests extends AbstractScalarFunctionTestCase {
         return parameterSuppliersFromTypedData(List.of(new TestCaseSupplier("large double value", () -> {
             double arg = 1 / randomDouble();
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(arg, DataTypes.DOUBLE, "arg")),
                 "SinhEvaluator[val=Attribute[channel=0]]",
+                DataTypes.DOUBLE,
                 equalTo(Math.sinh(arg))
             );
         })));

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/TanTests.java

@@ -31,9 +31,9 @@ public class TanTests extends AbstractScalarFunctionTestCase {
         return parameterSuppliersFromTypedData(List.of(new TestCaseSupplier("large double value", () -> {
             double arg = 1 / randomDouble();
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(arg, DataTypes.DOUBLE, "arg")),
                 "TanEvaluator[val=Attribute[channel=0]]",
+                DataTypes.DOUBLE,
                 equalTo(Math.tan(arg))
             );
         })));

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/TanhTests.java

@@ -31,9 +31,9 @@ public class TanhTests extends AbstractScalarFunctionTestCase {
         return parameterSuppliersFromTypedData(List.of(new TestCaseSupplier("large double value", () -> {
             double arg = 1 / randomDouble();
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(arg, DataTypes.DOUBLE, "arg")),
                 "TanhEvaluator[val=Attribute[channel=0]]",
+                DataTypes.DOUBLE,
                 equalTo(Math.tanh(arg))
             );
         })));

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/math/TauTests.java

@@ -32,9 +32,9 @@ public class TauTests extends AbstractScalarFunctionTestCase {
     public static Iterable<Object[]> parameters() {
         return parameterSuppliersFromTypedData(List.of(new TestCaseSupplier("Tau Test", () -> {
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(1, DataTypes.INTEGER, "foo")),
                 "LiteralsEvaluator[block=6.283185307179586]",
+                DataTypes.DOUBLE,
                 equalTo(Tau.TAU)
             );
         })));

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvAvgTests.java

@@ -48,9 +48,9 @@ public class MvAvgTests extends AbstractMultivalueFunctionTestCase {
         return parameterSuppliersFromTypedData(List.of(new TestCaseSupplier("mv_avg(<double>)", () -> {
             List<Double> mvData = randomList(1, 100, () -> randomDouble());
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(mvData, DataTypes.DOUBLE, "field")),
                 "MvAvg[field=Attribute[channel=0]]",
+                DataTypes.DOUBLE,
                 equalTo(mvData.stream().mapToDouble(Double::doubleValue).summaryStatistics().getAverage())
             );
         })));

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvConcatTests.java

@@ -36,12 +36,12 @@ public class MvConcatTests extends AbstractScalarFunctionTestCase {
     public static Iterable<Object[]> parameters() {
         return parameterSuppliersFromTypedData(List.of(new TestCaseSupplier("mv_concat basic test", () -> {
             return new TestCase(
-                Source.EMPTY,
                 List.of(
                     new TypedData(List.of(new BytesRef("foo"), new BytesRef("bar"), new BytesRef("baz")), DataTypes.KEYWORD, "field"),
                     new TypedData(new BytesRef(", "), DataTypes.KEYWORD, "delim")
                 ),
                 "MvConcat[field=Attribute[channel=0], delim=Attribute[channel=1]]",
+                DataTypes.KEYWORD,
                 equalTo(new BytesRef("foo, bar, baz"))
             );
         })));

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvCountTests.java

@@ -32,9 +32,9 @@ public class MvCountTests extends AbstractMultivalueFunctionTestCase {
         return parameterSuppliersFromTypedData(List.of(new TestCaseSupplier("mv_count(<double>)", () -> {
             List<Double> mvData = randomList(1, 100, () -> randomDouble());
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(mvData, DataTypes.DOUBLE, "field")),
                 "MvCount[field=Attribute[channel=0]]",
+                DataTypes.INTEGER,
                 equalTo(mvData.size())
             );
         })));

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvDedupeTests.java

@@ -36,9 +36,9 @@ public class MvDedupeTests extends AbstractMultivalueFunctionTestCase {
         return parameterSuppliersFromTypedData(List.of(new TestCaseSupplier("mv_dedupe(<double>)", () -> {
             List<Double> mvData = randomList(1, 100, () -> randomDouble());
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(mvData, DataTypes.DOUBLE, "field")),
                 "MvDedupe[field=Attribute[channel=0]]",
+                DataTypes.DOUBLE,
                 getMatcher(mvData)
             );
         })));

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvMaxTests.java

@@ -36,9 +36,9 @@ public class MvMaxTests extends AbstractMultivalueFunctionTestCase {
         return parameterSuppliersFromTypedData(List.of(new TestCaseSupplier("mv_max(<double>)", () -> {
             List<Double> mvData = randomList(1, 100, () -> randomDouble());
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(mvData, DataTypes.DOUBLE, "field")),
                 "MvMax[field=Attribute[channel=0]]",
+                DataTypes.DOUBLE,
                 equalTo(mvData.stream().mapToDouble(Double::doubleValue).summaryStatistics().getMax())
             );
         })));

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvMedianTests.java

@@ -40,9 +40,9 @@ public class MvMedianTests extends AbstractMultivalueFunctionTestCase {
         return parameterSuppliersFromTypedData(List.of(new TestCaseSupplier("mv_median(<double>)", () -> {
             List<Double> mvData = randomList(1, 100, () -> randomDouble());
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(mvData, DataTypes.DOUBLE, "field")),
                 "MvMedian[field=Attribute[channel=0]]",
+                DataTypes.DOUBLE,
                 getMatcher(mvData, DataTypes.DOUBLE)
             );
         })));

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvMinTests.java

@@ -36,9 +36,9 @@ public class MvMinTests extends AbstractMultivalueFunctionTestCase {
         return parameterSuppliersFromTypedData(List.of(new TestCaseSupplier("mv_min(<double>)", () -> {
             List<Double> mvData = randomList(1, 100, () -> randomDouble());
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(mvData, DataTypes.DOUBLE, "field")),
                 "MvMin[field=Attribute[channel=0]]",
+                DataTypes.DOUBLE,
                 equalTo(mvData.stream().mapToDouble(Double::doubleValue).summaryStatistics().getMin())
             );
         })));

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/multivalue/MvSumTests.java

@@ -36,9 +36,9 @@ public class MvSumTests extends AbstractMultivalueFunctionTestCase {
         return parameterSuppliersFromTypedData(List.of(new TestCaseSupplier("mv_sum(<double>)", () -> {
             List<Double> mvData = randomList(1, 100, () -> randomDouble());
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(mvData, DataTypes.DOUBLE, "field")),
                 "MvSum[field=Attribute[channel=0]]",
+                DataTypes.DOUBLE,
                 equalTo(mvData.stream().mapToDouble(Double::doubleValue).summaryStatistics().getSum())
             );
         })));

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/ConcatTests.java

@@ -39,9 +39,9 @@ public class ConcatTests extends AbstractScalarFunctionTestCase {
             BytesRef first = new BytesRef(randomAlphaOfLength(3));
             BytesRef second = new BytesRef(randomAlphaOfLength(3));
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(first, DataTypes.KEYWORD, "first"), new TypedData(second, DataTypes.KEYWORD, "second")),
                 "ConcatEvaluator[values=[Attribute[channel=0], Attribute[channel=1]]]",
+                DataTypes.KEYWORD,
                 equalTo(new BytesRef(first.utf8ToString() + second.utf8ToString()))
             );
         })));

+ 2 - 2
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/LengthTests.java

@@ -34,9 +34,9 @@ public class LengthTests extends AbstractScalarFunctionTestCase {
         return parameterSuppliersFromTypedData(List.of(new TestCaseSupplier("length basic test", () -> {
             BytesRef value = new BytesRef(randomAlphaOfLength(between(0, 10000)));
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(value, DataTypes.KEYWORD, "f")),
                 "LengthEvaluator[val=Attribute[channel=0]]",
+                DataTypes.INTEGER,
                 equalTo(UnicodeUtil.codePointCount(value))
             );
         }),
@@ -52,9 +52,9 @@ public class LengthTests extends AbstractScalarFunctionTestCase {
 
     private static TestCase makeTestCase(String text, int expectedLength) {
         return new TestCase(
-            Source.EMPTY,
             List.of(new TypedData(new BytesRef(text), DataTypes.KEYWORD, "f")),
             "LengthEvaluator[val=Attribute[channel=0]]",
+            DataTypes.INTEGER,
             equalTo(expectedLength)
         );
     }

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/SplitTests.java

@@ -48,12 +48,12 @@ public class SplitTests extends AbstractScalarFunctionTestCase {
                 .collect(Collectors.toList());
             String str = strings.stream().map(BytesRef::utf8ToString).collect(joining(delimiter));
             return new TestCase(
-                Source.EMPTY,
                 List.of(
                     new TypedData(new BytesRef(str), DataTypes.KEYWORD, "str"),
                     new TypedData(new BytesRef(delimiter), DataTypes.KEYWORD, "delim")
                 ),
                 "SplitVariableEvaluator[str=Attribute[channel=0], delim=Attribute[channel=1]]",
+                DataTypes.KEYWORD,
                 equalTo(strings.size() == 1 ? strings.get(0) : strings)
             );
         })));

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/StartsWithTests.java

@@ -37,12 +37,12 @@ public class StartsWithTests extends AbstractScalarFunctionTestCase {
                 str = prefix + str;
             }
             return new TestCase(
-                Source.EMPTY,
                 List.of(
                     new TypedData(new BytesRef(str), DataTypes.KEYWORD, "str"),
                     new TypedData(new BytesRef(prefix), DataTypes.KEYWORD, "prefix")
                 ),
                 "StartsWithEvaluator[str=Attribute[channel=0], prefix=Attribute[channel=1]]",
+                DataTypes.BOOLEAN,
                 equalTo(str.startsWith(prefix))
             );
         })));

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/SubstringTests.java

@@ -39,13 +39,13 @@ public class SubstringTests extends AbstractScalarFunctionTestCase {
             int length = between(1, 10 - start);
             String text = randomAlphaOfLength(10);
             return new TestCase(
-                Source.EMPTY,
                 List.of(
                     new TypedData(new BytesRef(text), DataTypes.KEYWORD, "str"),
                     new TypedData(start, DataTypes.INTEGER, "start"),
                     new TypedData(length, DataTypes.INTEGER, "end")
                 ),
                 "SubstringEvaluator[str=Attribute[channel=0], start=Attribute[channel=1], length=Attribute[channel=2]]",
+                DataTypes.KEYWORD,
                 equalTo(new BytesRef(text.substring(start - 1, start + length - 1)))
             );
         })));

+ 3 - 2
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/TrimTests.java

@@ -31,10 +31,11 @@ public class TrimTests extends AbstractScalarFunctionTestCase {
     public static Iterable<Object[]> parameters() {
         return parameterSuppliersFromTypedData(List.of(new TestCaseSupplier("Trim basic test", () -> {
             BytesRef sampleData = addRandomLeadingOrTrailingWhitespaces(randomUnicodeOfLength(8));
+            DataType dataType = randomFrom(strings());
             return new TestCase(
-                Source.EMPTY,
-                List.of(new TypedData(sampleData, randomFrom(strings()), "str")),
+                List.of(new TypedData(sampleData, dataType, "str")),
                 "TrimEvaluator[val=Attribute[channel=0]]",
+                dataType,
                 equalTo(new BytesRef(sampleData.utf8ToString().trim()))
             );
         })));

+ 3 - 3
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/predicate/operator/arithmetic/AddTests.java

@@ -35,9 +35,9 @@ public class AddTests extends AbstractArithmeticTestCase {
             int rhs = randomIntBetween((Integer.MIN_VALUE >> 1) - 1, (Integer.MAX_VALUE >> 1) - 1);
             int lhs = randomIntBetween((Integer.MIN_VALUE >> 1) - 1, (Integer.MAX_VALUE >> 1) - 1);
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(lhs, DataTypes.INTEGER, "lhs"), new TypedData(rhs, DataTypes.INTEGER, "rhs")),
                 "AddIntsEvaluator[lhs=Attribute[channel=0], rhs=Attribute[channel=1]]",
+                DataTypes.INTEGER,
                 equalTo(lhs + rhs)
             );
         }), new TestCaseSupplier("Long + Long", () -> {
@@ -45,18 +45,18 @@ public class AddTests extends AbstractArithmeticTestCase {
             long rhs = randomLongBetween((Long.MIN_VALUE >> 1) - 1, (Long.MAX_VALUE >> 1) - 1);
             long lhs = randomLongBetween((Long.MIN_VALUE >> 1) - 1, (Long.MAX_VALUE >> 1) - 1);
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(lhs, DataTypes.LONG, "lhs"), new TypedData(rhs, DataTypes.LONG, "rhs")),
                 "AddLongsEvaluator[lhs=Attribute[channel=0], rhs=Attribute[channel=1]]",
+                DataTypes.LONG,
                 equalTo(lhs + rhs)
             );
         }), new TestCaseSupplier("Double + Double", () -> {
             double rhs = randomDouble();
             double lhs = randomDouble();
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(lhs, DataTypes.DOUBLE, "lhs"), new TypedData(rhs, DataTypes.DOUBLE, "rhs")),
                 "AddDoublesEvaluator[lhs=Attribute[channel=0], rhs=Attribute[channel=1]]",
+                DataTypes.DOUBLE,
                 equalTo(lhs + rhs)
             );
         })/*, new TestCaseSupplier("ULong + ULong", () -> {

+ 3 - 3
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/predicate/operator/arithmetic/DivTests.java

@@ -37,9 +37,9 @@ public class DivTests extends AbstractArithmeticTestCase {
                 rhs = randomInt();
             } while (rhs == 0);
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(lhs, DataTypes.INTEGER, "lhs"), new TypedData(rhs, DataTypes.INTEGER, "rhs")),
                 "DivIntsEvaluator[lhs=Attribute[channel=0], rhs=Attribute[channel=1]]",
+                DataTypes.INTEGER,
                 equalTo(lhs / rhs)
             );
         }), new TestCaseSupplier("Long / Long", () -> {
@@ -49,9 +49,9 @@ public class DivTests extends AbstractArithmeticTestCase {
                 rhs = randomLong();
             } while (rhs == 0);
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(lhs, DataTypes.LONG, "lhs"), new TypedData(rhs, DataTypes.LONG, "rhs")),
                 "DivLongsEvaluator[lhs=Attribute[channel=0], rhs=Attribute[channel=1]]",
+                DataTypes.LONG,
                 equalTo(lhs / rhs)
             );
         }), new TestCaseSupplier("Double / Double", () -> {
@@ -61,9 +61,9 @@ public class DivTests extends AbstractArithmeticTestCase {
                 rhs = randomDouble();
             } while (rhs == 0);
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(lhs, DataTypes.DOUBLE, "lhs"), new TypedData(rhs, DataTypes.DOUBLE, "rhs")),
                 "DivDoublesEvaluator[lhs=Attribute[channel=0], rhs=Attribute[channel=1]]",
+                DataTypes.DOUBLE,
                 equalTo(lhs / rhs)
             );
         })/*, new TestCaseSupplier("ULong / ULong", () -> {

+ 3 - 3
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/predicate/operator/arithmetic/ModTests.java

@@ -37,9 +37,9 @@ public class ModTests extends AbstractArithmeticTestCase {
                 rhs = randomInt();
             } while (rhs == 0);
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(lhs, DataTypes.INTEGER, "lhs"), new TypedData(rhs, DataTypes.INTEGER, "rhs")),
                 "ModIntsEvaluator[lhs=Attribute[channel=0], rhs=Attribute[channel=1]]",
+                DataTypes.INTEGER,
                 equalTo(lhs % rhs)
             );
         }), new TestCaseSupplier("Long % Long", () -> {
@@ -49,9 +49,9 @@ public class ModTests extends AbstractArithmeticTestCase {
                 rhs = randomLong();
             } while (rhs == 0);
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(lhs, DataTypes.LONG, "lhs"), new TypedData(rhs, DataTypes.LONG, "rhs")),
                 "ModLongsEvaluator[lhs=Attribute[channel=0], rhs=Attribute[channel=1]]",
+                DataTypes.LONG,
                 equalTo(lhs % rhs)
             );
         }), new TestCaseSupplier("Double % Double", () -> {
@@ -61,9 +61,9 @@ public class ModTests extends AbstractArithmeticTestCase {
                 rhs = randomDouble();
             } while (rhs == 0);
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(lhs, DataTypes.DOUBLE, "lhs"), new TypedData(rhs, DataTypes.DOUBLE, "rhs")),
                 "ModDoublesEvaluator[lhs=Attribute[channel=0], rhs=Attribute[channel=1]]",
+                DataTypes.DOUBLE,
                 equalTo(lhs % rhs)
             );
         })/*, new TestCaseSupplier("ULong % ULong", () -> {

+ 3 - 3
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/predicate/operator/arithmetic/MulTests.java

@@ -35,9 +35,9 @@ public class MulTests extends AbstractArithmeticTestCase {
             int rhs = randomIntBetween(-255, 255);
             int lhs = randomIntBetween(-255, 255);
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(lhs, DataTypes.INTEGER, "lhs"), new TypedData(rhs, DataTypes.INTEGER, "rhs")),
                 "MulIntsEvaluator[lhs=Attribute[channel=0], rhs=Attribute[channel=1]]",
+                DataTypes.INTEGER,
                 equalTo(lhs * rhs)
             );
         }), new TestCaseSupplier("Long * Long", () -> {
@@ -45,18 +45,18 @@ public class MulTests extends AbstractArithmeticTestCase {
             long rhs = randomLongBetween(-1024, 1024);
             long lhs = randomLongBetween(-1024, 1024);
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(lhs, DataTypes.LONG, "lhs"), new TypedData(rhs, DataTypes.LONG, "rhs")),
                 "MulLongsEvaluator[lhs=Attribute[channel=0], rhs=Attribute[channel=1]]",
+                DataTypes.LONG,
                 equalTo(lhs * rhs)
             );
         }), new TestCaseSupplier("Double * Double", () -> {
             double rhs = randomDouble();
             double lhs = randomDouble();
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(lhs, DataTypes.DOUBLE, "lhs"), new TypedData(rhs, DataTypes.DOUBLE, "rhs")),
                 "MulDoublesEvaluator[lhs=Attribute[channel=0], rhs=Attribute[channel=1]]",
+                DataTypes.DOUBLE,
                 equalTo(lhs * rhs)
             );
         })/*, new TestCaseSupplier("ULong * ULong", () -> {

+ 3 - 3
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/predicate/operator/arithmetic/SubTests.java

@@ -35,9 +35,9 @@ public class SubTests extends AbstractArithmeticTestCase {
             int rhs = randomIntBetween((Integer.MIN_VALUE >> 1) - 1, (Integer.MAX_VALUE >> 1) - 1);
             int lhs = randomIntBetween((Integer.MIN_VALUE >> 1) - 1, (Integer.MAX_VALUE >> 1) - 1);
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(lhs, DataTypes.INTEGER, "lhs"), new TypedData(rhs, DataTypes.INTEGER, "rhs")),
                 "SubIntsEvaluator[lhs=Attribute[channel=0], rhs=Attribute[channel=1]]",
+                DataTypes.INTEGER,
                 equalTo(lhs - rhs)
             );
         }), new TestCaseSupplier("Long - Long", () -> {
@@ -45,18 +45,18 @@ public class SubTests extends AbstractArithmeticTestCase {
             long rhs = randomLongBetween((Long.MIN_VALUE >> 1) - 1, (Long.MAX_VALUE >> 1) - 1);
             long lhs = randomLongBetween((Long.MIN_VALUE >> 1) - 1, (Long.MAX_VALUE >> 1) - 1);
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(lhs, DataTypes.LONG, "lhs"), new TypedData(rhs, DataTypes.LONG, "rhs")),
                 "SubLongsEvaluator[lhs=Attribute[channel=0], rhs=Attribute[channel=1]]",
+                DataTypes.LONG,
                 equalTo(lhs - rhs)
             );
         }), new TestCaseSupplier("Double - Double", () -> {
             double rhs = randomDouble();
             double lhs = randomDouble();
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(lhs, DataTypes.DOUBLE, "lhs"), new TypedData(rhs, DataTypes.DOUBLE, "rhs")),
                 "SubDoublesEvaluator[lhs=Attribute[channel=0], rhs=Attribute[channel=1]]",
+                DataTypes.DOUBLE,
                 equalTo(lhs - rhs)
             );
         })/*, new TestCaseSupplier("ULong - ULong", () -> {

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/predicate/operator/comparison/EqualsTests.java

@@ -33,9 +33,9 @@ public class EqualsTests extends AbstractBinaryComparisonTestCase {
             int rhs = randomInt();
             int lhs = randomInt();
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(lhs, DataTypes.INTEGER, "lhs"), new TypedData(rhs, DataTypes.INTEGER, "rhs")),
                 "EqualsIntsEvaluator[lhs=Attribute[channel=0], rhs=Attribute[channel=1]]",
+                DataTypes.BOOLEAN,
                 equalTo(lhs == rhs)
             );
         })));

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/predicate/operator/comparison/GreaterThanOrEqualTests.java

@@ -34,9 +34,9 @@ public class GreaterThanOrEqualTests extends AbstractBinaryComparisonTestCase {
             int rhs = randomInt();
             int lhs = randomInt();
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(lhs, DataTypes.INTEGER, "lhs"), new TypedData(rhs, DataTypes.INTEGER, "rhs")),
                 "GreaterThanOrEqualIntsEvaluator[lhs=Attribute[channel=0], rhs=Attribute[channel=1]]",
+                DataTypes.BOOLEAN,
                 equalTo(lhs >= rhs)
             );
         })));

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/predicate/operator/comparison/GreaterThanTests.java

@@ -34,9 +34,9 @@ public class GreaterThanTests extends AbstractBinaryComparisonTestCase {
             int rhs = randomInt();
             int lhs = randomInt();
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(lhs, DataTypes.INTEGER, "lhs"), new TypedData(rhs, DataTypes.INTEGER, "rhs")),
                 "GreaterThanIntsEvaluator[lhs=Attribute[channel=0], rhs=Attribute[channel=1]]",
+                DataTypes.BOOLEAN,
                 equalTo(lhs > rhs)
             );
         })));

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/predicate/operator/comparison/LessThanOrEqualTests.java

@@ -34,9 +34,9 @@ public class LessThanOrEqualTests extends AbstractBinaryComparisonTestCase {
             int rhs = randomInt();
             int lhs = randomInt();
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(lhs, DataTypes.INTEGER, "lhs"), new TypedData(rhs, DataTypes.INTEGER, "rhs")),
                 "LessThanOrEqualIntsEvaluator[lhs=Attribute[channel=0], rhs=Attribute[channel=1]]",
+                DataTypes.BOOLEAN,
                 equalTo(lhs <= rhs)
             );
         })));

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/predicate/operator/comparison/LessThanTests.java

@@ -34,9 +34,9 @@ public class LessThanTests extends AbstractBinaryComparisonTestCase {
             int rhs = randomInt();
             int lhs = randomInt();
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(lhs, DataTypes.INTEGER, "lhs"), new TypedData(rhs, DataTypes.INTEGER, "rhs")),
                 "LessThanIntsEvaluator[lhs=Attribute[channel=0], rhs=Attribute[channel=1]]",
+                DataTypes.BOOLEAN,
                 equalTo(lhs < rhs)
             );
         })));

+ 1 - 1
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/predicate/operator/comparison/NotEqualsTests.java

@@ -34,9 +34,9 @@ public class NotEqualsTests extends AbstractBinaryComparisonTestCase {
             int rhs = randomInt();
             int lhs = randomInt();
             return new TestCase(
-                Source.EMPTY,
                 List.of(new TypedData(lhs, DataTypes.INTEGER, "lhs"), new TypedData(rhs, DataTypes.INTEGER, "rhs")),
                 "NotEqualsIntsEvaluator[lhs=Attribute[channel=0], rhs=Attribute[channel=1]]",
+                DataTypes.BOOLEAN,
                 equalTo(lhs != rhs)
             );
         })));