Browse Source

ESQL: Renamed TopList to Top (#110347)

Rename TopList aggregation to Top, after internal discussions
Iván Cea Fontenla 1 year ago
parent
commit
c89ee3b648
45 changed files with 417 additions and 412 deletions
  1. 5 0
      docs/changelog/110347.yaml
  2. 2 2
      docs/reference/esql/functions/aggregation-functions.asciidoc
  3. 0 0
      docs/reference/esql/functions/description/top.asciidoc
  4. 2 2
      docs/reference/esql/functions/examples/top.asciidoc
  5. 2 2
      docs/reference/esql/functions/kibana/definition/top.json
  6. 2 2
      docs/reference/esql/functions/kibana/docs/top.md
  7. 15 0
      docs/reference/esql/functions/layout/top.asciidoc
  8. 0 15
      docs/reference/esql/functions/layout/top_list.asciidoc
  9. 0 0
      docs/reference/esql/functions/parameters/top.asciidoc
  10. 1 0
      docs/reference/esql/functions/signature/top.svg
  11. 0 1
      docs/reference/esql/functions/signature/top_list.svg
  12. 0 0
      docs/reference/esql/functions/types/top.asciidoc
  13. 9 9
      x-pack/plugin/esql/compute/build.gradle
  14. 2 2
      x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/TopDoubleAggregator.java
  15. 2 2
      x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/TopFloatAggregator.java
  16. 2 2
      x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/TopIntAggregator.java
  17. 2 2
      x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/TopLongAggregator.java
  18. 12 12
      x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopDoubleAggregatorFunction.java
  19. 9 9
      x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopDoubleAggregatorFunctionSupplier.java
  20. 17 17
      x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopDoubleGroupingAggregatorFunction.java
  21. 12 12
      x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopFloatAggregatorFunction.java
  22. 9 9
      x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopFloatAggregatorFunctionSupplier.java
  23. 17 17
      x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopFloatGroupingAggregatorFunction.java
  24. 12 12
      x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopIntAggregatorFunction.java
  25. 9 9
      x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopIntAggregatorFunctionSupplier.java
  26. 17 17
      x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopIntGroupingAggregatorFunction.java
  27. 12 12
      x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopLongAggregatorFunction.java
  28. 9 9
      x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopLongAggregatorFunctionSupplier.java
  29. 17 17
      x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopLongGroupingAggregatorFunction.java
  30. 2 2
      x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/X-TopAggregator.java.st
  31. 3 3
      x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/aggregation/TopDoubleAggregatorFunctionTests.java
  32. 3 3
      x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/aggregation/TopFloatAggregatorFunctionTests.java
  33. 3 3
      x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/aggregation/TopIntAggregatorFunctionTests.java
  34. 3 3
      x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/aggregation/TopLongAggregatorFunctionTests.java
  35. 4 4
      x-pack/plugin/esql/qa/testFixtures/src/main/resources/meta.csv-spec
  36. 156 0
      x-pack/plugin/esql/qa/testFixtures/src/main/resources/stats_top.csv-spec
  37. 0 156
      x-pack/plugin/esql/qa/testFixtures/src/main/resources/stats_top_list.csv-spec
  38. 2 2
      x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java
  39. 2 2
      x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/EsqlFunctionRegistry.java
  40. 1 1
      x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/AggregateFunction.java
  41. 15 15
      x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Top.java
  42. 2 2
      x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/package-info.java
  43. 3 3
      x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/planner/AggregateMapper.java
  44. 5 5
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/aggregate/TopSerializationTests.java
  45. 15 15
      x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/aggregate/TopTests.java

+ 5 - 0
docs/changelog/110347.yaml

@@ -0,0 +1,5 @@
+pr: 110347
+summary: "ESQL: Renamed `TopList` to Top"
+area: ES|QL
+type: enhancement
+issues: []

+ 2 - 2
docs/reference/esql/functions/aggregation-functions.asciidoc

@@ -18,7 +18,7 @@ The <<esql-stats-by>> command supports these aggregate functions:
 * <<esql-agg-percentile>>
 * experimental:[] <<esql-agg-st-centroid>>
 * <<esql-agg-sum>>
-* <<esql-top_list>>
+* <<esql-top>>
 * <<esql-agg-values>>
 // end::agg_list[]
 
@@ -32,5 +32,5 @@ include::min.asciidoc[]
 include::percentile.asciidoc[]
 include::st_centroid_agg.asciidoc[]
 include::sum.asciidoc[]
-include::layout/top_list.asciidoc[]
+include::layout/top.asciidoc[]
 include::values.asciidoc[]

+ 0 - 0
docs/reference/esql/functions/description/top_list.asciidoc → docs/reference/esql/functions/description/top.asciidoc


+ 2 - 2
docs/reference/esql/functions/examples/top_list.asciidoc → docs/reference/esql/functions/examples/top.asciidoc

@@ -4,10 +4,10 @@
 
 [source.merge.styled,esql]
 ----
-include::{esql-specs}/stats_top_list.csv-spec[tag=top-list]
+include::{esql-specs}/stats_top.csv-spec[tag=top]
 ----
 [%header.monospaced.styled,format=dsv,separator=|]
 |===
-include::{esql-specs}/stats_top_list.csv-spec[tag=top-list-result]
+include::{esql-specs}/stats_top.csv-spec[tag=top-result]
 |===
 

+ 2 - 2
docs/reference/esql/functions/kibana/definition/top_list.json → docs/reference/esql/functions/kibana/definition/top.json

@@ -1,7 +1,7 @@
 {
   "comment" : "This is generated by ESQL's AbstractFunctionTestCase. Do no edit it. See ../README.md for how to regenerate it.",
   "type" : "agg",
-  "name" : "top_list",
+  "name" : "top",
   "description" : "Collects the top values for a field. Includes repeated values.",
   "signatures" : [
     {
@@ -102,6 +102,6 @@
     }
   ],
   "examples" : [
-    "FROM employees\n| STATS top_salaries = TOP_LIST(salary, 3, \"desc\"), top_salary = MAX(salary)"
+    "FROM employees\n| STATS top_salaries = TOP(salary, 3, \"desc\"), top_salary = MAX(salary)"
   ]
 }

+ 2 - 2
docs/reference/esql/functions/kibana/docs/top_list.md → docs/reference/esql/functions/kibana/docs/top.md

@@ -2,10 +2,10 @@
 This is generated by ESQL's AbstractFunctionTestCase. Do no edit it. See ../README.md for how to regenerate it.
 -->
 
-### TOP_LIST
+### TOP
 Collects the top values for a field. Includes repeated values.
 
 ```
 FROM employees
-| STATS top_salaries = TOP_LIST(salary, 3, "desc"), top_salary = MAX(salary)
+| STATS top_salaries = TOP(salary, 3, "desc"), top_salary = MAX(salary)
 ```

+ 15 - 0
docs/reference/esql/functions/layout/top.asciidoc

@@ -0,0 +1,15 @@
+// This is generated by ESQL's AbstractFunctionTestCase. Do no edit it. See ../README.md for how to regenerate it.
+
+[discrete]
+[[esql-top]]
+=== `TOP`
+
+*Syntax*
+
+[.text-center]
+image::esql/functions/signature/top.svg[Embedded,opts=inline]
+
+include::../parameters/top.asciidoc[]
+include::../description/top.asciidoc[]
+include::../types/top.asciidoc[]
+include::../examples/top.asciidoc[]

+ 0 - 15
docs/reference/esql/functions/layout/top_list.asciidoc

@@ -1,15 +0,0 @@
-// This is generated by ESQL's AbstractFunctionTestCase. Do no edit it. See ../README.md for how to regenerate it.
-
-[discrete]
-[[esql-top_list]]
-=== `TOP_LIST`
-
-*Syntax*
-
-[.text-center]
-image::esql/functions/signature/top_list.svg[Embedded,opts=inline]
-
-include::../parameters/top_list.asciidoc[]
-include::../description/top_list.asciidoc[]
-include::../types/top_list.asciidoc[]
-include::../examples/top_list.asciidoc[]

+ 0 - 0
docs/reference/esql/functions/parameters/top_list.asciidoc → docs/reference/esql/functions/parameters/top.asciidoc


+ 1 - 0
docs/reference/esql/functions/signature/top.svg

@@ -0,0 +1 @@
+<svg version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" width="504" height="46" viewbox="0 0 504 46"><defs><style type="text/css">#guide .c{fill:none;stroke:#222222;}#guide .k{fill:#000000;font-family:Roboto Mono,Sans-serif;font-size:20px;}#guide .s{fill:#e4f4ff;stroke:#222222;}#guide .syn{fill:#8D8D8D;font-family:Roboto Mono,Sans-serif;font-size:20px;}</style></defs><path class="c" d="M0 31h5m56 0h10m32 0h10m80 0h10m32 0h10m80 0h10m32 0h10m80 0h10m32 0h5"/><rect class="s" x="5" y="5" width="56" height="36"/><text class="k" x="15" y="31">TOP</text><rect class="s" x="71" y="5" width="32" height="36" rx="7"/><text class="syn" x="81" y="31">(</text><rect class="s" x="113" y="5" width="80" height="36" rx="7"/><text class="k" x="123" y="31">field</text><rect class="s" x="203" y="5" width="32" height="36" rx="7"/><text class="syn" x="213" y="31">,</text><rect class="s" x="245" y="5" width="80" height="36" rx="7"/><text class="k" x="255" y="31">limit</text><rect class="s" x="335" y="5" width="32" height="36" rx="7"/><text class="syn" x="345" y="31">,</text><rect class="s" x="377" y="5" width="80" height="36" rx="7"/><text class="k" x="387" y="31">order</text><rect class="s" x="467" y="5" width="32" height="36" rx="7"/><text class="syn" x="477" y="31">)</text></svg>

+ 0 - 1
docs/reference/esql/functions/signature/top_list.svg

@@ -1 +0,0 @@
-<svg version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" width="564" height="46" viewbox="0 0 564 46"><defs><style type="text/css">#guide .c{fill:none;stroke:#222222;}#guide .k{fill:#000000;font-family:Roboto Mono,Sans-serif;font-size:20px;}#guide .s{fill:#e4f4ff;stroke:#222222;}#guide .syn{fill:#8D8D8D;font-family:Roboto Mono,Sans-serif;font-size:20px;}</style></defs><path class="c" d="M0 31h5m116 0h10m32 0h10m80 0h10m32 0h10m80 0h10m32 0h10m80 0h10m32 0h5"/><rect class="s" x="5" y="5" width="116" height="36"/><text class="k" x="15" y="31">TOP_LIST</text><rect class="s" x="131" y="5" width="32" height="36" rx="7"/><text class="syn" x="141" y="31">(</text><rect class="s" x="173" y="5" width="80" height="36" rx="7"/><text class="k" x="183" y="31">field</text><rect class="s" x="263" y="5" width="32" height="36" rx="7"/><text class="syn" x="273" y="31">,</text><rect class="s" x="305" y="5" width="80" height="36" rx="7"/><text class="k" x="315" y="31">limit</text><rect class="s" x="395" y="5" width="32" height="36" rx="7"/><text class="syn" x="405" y="31">,</text><rect class="s" x="437" y="5" width="80" height="36" rx="7"/><text class="k" x="447" y="31">order</text><rect class="s" x="527" y="5" width="32" height="36" rx="7"/><text class="syn" x="537" y="31">)</text></svg>

+ 0 - 0
docs/reference/esql/functions/types/top_list.asciidoc → docs/reference/esql/functions/types/top.asciidoc


+ 9 - 9
x-pack/plugin/esql/compute/build.gradle

@@ -523,26 +523,26 @@ tasks.named('stringTemplates').configure {
   }
 
 
-  File topListAggregatorInputFile = new File("${projectDir}/src/main/java/org/elasticsearch/compute/aggregation/X-TopListAggregator.java.st")
+  File topAggregatorInputFile = new File("${projectDir}/src/main/java/org/elasticsearch/compute/aggregation/X-TopAggregator.java.st")
   template {
     it.properties = intProperties
-    it.inputFile =  topListAggregatorInputFile
-    it.outputFile = "org/elasticsearch/compute/aggregation/TopListIntAggregator.java"
+    it.inputFile =  topAggregatorInputFile
+    it.outputFile = "org/elasticsearch/compute/aggregation/TopIntAggregator.java"
   }
   template {
     it.properties = longProperties
-    it.inputFile =  topListAggregatorInputFile
-    it.outputFile = "org/elasticsearch/compute/aggregation/TopListLongAggregator.java"
+    it.inputFile =  topAggregatorInputFile
+    it.outputFile = "org/elasticsearch/compute/aggregation/TopLongAggregator.java"
   }
   template {
     it.properties = floatProperties
-    it.inputFile =  topListAggregatorInputFile
-    it.outputFile = "org/elasticsearch/compute/aggregation/TopListFloatAggregator.java"
+    it.inputFile =  topAggregatorInputFile
+    it.outputFile = "org/elasticsearch/compute/aggregation/TopFloatAggregator.java"
   }
   template {
     it.properties = doubleProperties
-    it.inputFile =  topListAggregatorInputFile
-    it.outputFile = "org/elasticsearch/compute/aggregation/TopListDoubleAggregator.java"
+    it.inputFile =  topAggregatorInputFile
+    it.outputFile = "org/elasticsearch/compute/aggregation/TopDoubleAggregator.java"
   }
 
   File multivalueDedupeInputFile = file("src/main/java/org/elasticsearch/compute/operator/mvdedupe/X-MultivalueDedupe.java.st")

+ 2 - 2
x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/TopListDoubleAggregator.java → x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/TopDoubleAggregator.java

@@ -24,9 +24,9 @@ import org.elasticsearch.search.sort.SortOrder;
 /**
  * Aggregates the top N field values for double.
  */
-@Aggregator({ @IntermediateState(name = "topList", type = "DOUBLE_BLOCK") })
+@Aggregator({ @IntermediateState(name = "top", type = "DOUBLE_BLOCK") })
 @GroupingAggregator
-class TopListDoubleAggregator {
+class TopDoubleAggregator {
     public static SingleState initSingle(BigArrays bigArrays, int limit, boolean ascending) {
         return new SingleState(bigArrays, limit, ascending);
     }

+ 2 - 2
x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/TopListFloatAggregator.java → x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/TopFloatAggregator.java

@@ -24,9 +24,9 @@ import org.elasticsearch.search.sort.SortOrder;
 /**
  * Aggregates the top N field values for float.
  */
-@Aggregator({ @IntermediateState(name = "topList", type = "FLOAT_BLOCK") })
+@Aggregator({ @IntermediateState(name = "top", type = "FLOAT_BLOCK") })
 @GroupingAggregator
-class TopListFloatAggregator {
+class TopFloatAggregator {
     public static SingleState initSingle(BigArrays bigArrays, int limit, boolean ascending) {
         return new SingleState(bigArrays, limit, ascending);
     }

+ 2 - 2
x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/TopListIntAggregator.java → x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/TopIntAggregator.java

@@ -24,9 +24,9 @@ import org.elasticsearch.search.sort.SortOrder;
 /**
  * Aggregates the top N field values for int.
  */
-@Aggregator({ @IntermediateState(name = "topList", type = "INT_BLOCK") })
+@Aggregator({ @IntermediateState(name = "top", type = "INT_BLOCK") })
 @GroupingAggregator
-class TopListIntAggregator {
+class TopIntAggregator {
     public static SingleState initSingle(BigArrays bigArrays, int limit, boolean ascending) {
         return new SingleState(bigArrays, limit, ascending);
     }

+ 2 - 2
x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/TopListLongAggregator.java → x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/TopLongAggregator.java

@@ -24,9 +24,9 @@ import org.elasticsearch.search.sort.SortOrder;
 /**
  * Aggregates the top N field values for long.
  */
-@Aggregator({ @IntermediateState(name = "topList", type = "LONG_BLOCK") })
+@Aggregator({ @IntermediateState(name = "top", type = "LONG_BLOCK") })
 @GroupingAggregator
-class TopListLongAggregator {
+class TopLongAggregator {
     public static SingleState initSingle(BigArrays bigArrays, int limit, boolean ascending) {
         return new SingleState(bigArrays, limit, ascending);
     }

+ 12 - 12
x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopListDoubleAggregatorFunction.java → x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopDoubleAggregatorFunction.java

@@ -17,16 +17,16 @@ import org.elasticsearch.compute.data.Page;
 import org.elasticsearch.compute.operator.DriverContext;
 
 /**
- * {@link AggregatorFunction} implementation for {@link TopListDoubleAggregator}.
+ * {@link AggregatorFunction} implementation for {@link TopDoubleAggregator}.
  * This class is generated. Do not edit it.
  */
-public final class TopListDoubleAggregatorFunction implements AggregatorFunction {
+public final class TopDoubleAggregatorFunction implements AggregatorFunction {
   private static final List<IntermediateStateDesc> INTERMEDIATE_STATE_DESC = List.of(
       new IntermediateStateDesc("topList", ElementType.DOUBLE)  );
 
   private final DriverContext driverContext;
 
-  private final TopListDoubleAggregator.SingleState state;
+  private final TopDoubleAggregator.SingleState state;
 
   private final List<Integer> channels;
 
@@ -34,8 +34,8 @@ public final class TopListDoubleAggregatorFunction implements AggregatorFunction
 
   private final boolean ascending;
 
-  public TopListDoubleAggregatorFunction(DriverContext driverContext, List<Integer> channels,
-      TopListDoubleAggregator.SingleState state, int limit, boolean ascending) {
+  public TopDoubleAggregatorFunction(DriverContext driverContext, List<Integer> channels,
+                                     TopDoubleAggregator.SingleState state, int limit, boolean ascending) {
     this.driverContext = driverContext;
     this.channels = channels;
     this.state = state;
@@ -43,9 +43,9 @@ public final class TopListDoubleAggregatorFunction implements AggregatorFunction
     this.ascending = ascending;
   }
 
-  public static TopListDoubleAggregatorFunction create(DriverContext driverContext,
-      List<Integer> channels, int limit, boolean ascending) {
-    return new TopListDoubleAggregatorFunction(driverContext, channels, TopListDoubleAggregator.initSingle(driverContext.bigArrays(), limit, ascending), limit, ascending);
+  public static TopDoubleAggregatorFunction create(DriverContext driverContext,
+                                                   List<Integer> channels, int limit, boolean ascending) {
+    return new TopDoubleAggregatorFunction(driverContext, channels, TopDoubleAggregator.initSingle(driverContext.bigArrays(), limit, ascending), limit, ascending);
   }
 
   public static List<IntermediateStateDesc> intermediateStateDesc() {
@@ -70,7 +70,7 @@ public final class TopListDoubleAggregatorFunction implements AggregatorFunction
 
   private void addRawVector(DoubleVector vector) {
     for (int i = 0; i < vector.getPositionCount(); i++) {
-      TopListDoubleAggregator.combine(state, vector.getDouble(i));
+      TopDoubleAggregator.combine(state, vector.getDouble(i));
     }
   }
 
@@ -82,7 +82,7 @@ public final class TopListDoubleAggregatorFunction implements AggregatorFunction
       int start = block.getFirstValueIndex(p);
       int end = start + block.getValueCount(p);
       for (int i = start; i < end; i++) {
-        TopListDoubleAggregator.combine(state, block.getDouble(i));
+        TopDoubleAggregator.combine(state, block.getDouble(i));
       }
     }
   }
@@ -97,7 +97,7 @@ public final class TopListDoubleAggregatorFunction implements AggregatorFunction
     }
     DoubleBlock topList = (DoubleBlock) topListUncast;
     assert topList.getPositionCount() == 1;
-    TopListDoubleAggregator.combineIntermediate(state, topList);
+    TopDoubleAggregator.combineIntermediate(state, topList);
   }
 
   @Override
@@ -107,7 +107,7 @@ public final class TopListDoubleAggregatorFunction implements AggregatorFunction
 
   @Override
   public void evaluateFinal(Block[] blocks, int offset, DriverContext driverContext) {
-    blocks[offset] = TopListDoubleAggregator.evaluateFinal(state, driverContext);
+    blocks[offset] = TopDoubleAggregator.evaluateFinal(state, driverContext);
   }
 
   @Override

+ 9 - 9
x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopListDoubleAggregatorFunctionSupplier.java → x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopDoubleAggregatorFunctionSupplier.java

@@ -11,35 +11,35 @@ import java.util.List;
 import org.elasticsearch.compute.operator.DriverContext;
 
 /**
- * {@link AggregatorFunctionSupplier} implementation for {@link TopListDoubleAggregator}.
+ * {@link AggregatorFunctionSupplier} implementation for {@link TopDoubleAggregator}.
  * This class is generated. Do not edit it.
  */
-public final class TopListDoubleAggregatorFunctionSupplier implements AggregatorFunctionSupplier {
+public final class TopDoubleAggregatorFunctionSupplier implements AggregatorFunctionSupplier {
   private final List<Integer> channels;
 
   private final int limit;
 
   private final boolean ascending;
 
-  public TopListDoubleAggregatorFunctionSupplier(List<Integer> channels, int limit,
-      boolean ascending) {
+  public TopDoubleAggregatorFunctionSupplier(List<Integer> channels, int limit,
+                                             boolean ascending) {
     this.channels = channels;
     this.limit = limit;
     this.ascending = ascending;
   }
 
   @Override
-  public TopListDoubleAggregatorFunction aggregator(DriverContext driverContext) {
-    return TopListDoubleAggregatorFunction.create(driverContext, channels, limit, ascending);
+  public TopDoubleAggregatorFunction aggregator(DriverContext driverContext) {
+    return TopDoubleAggregatorFunction.create(driverContext, channels, limit, ascending);
   }
 
   @Override
-  public TopListDoubleGroupingAggregatorFunction groupingAggregator(DriverContext driverContext) {
-    return TopListDoubleGroupingAggregatorFunction.create(channels, driverContext, limit, ascending);
+  public TopDoubleGroupingAggregatorFunction groupingAggregator(DriverContext driverContext) {
+    return TopDoubleGroupingAggregatorFunction.create(channels, driverContext, limit, ascending);
   }
 
   @Override
   public String describe() {
-    return "top_list of doubles";
+    return "top of doubles";
   }
 }

+ 17 - 17
x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopListDoubleGroupingAggregatorFunction.java → x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopDoubleGroupingAggregatorFunction.java

@@ -19,14 +19,14 @@ import org.elasticsearch.compute.data.Page;
 import org.elasticsearch.compute.operator.DriverContext;
 
 /**
- * {@link GroupingAggregatorFunction} implementation for {@link TopListDoubleAggregator}.
+ * {@link GroupingAggregatorFunction} implementation for {@link TopDoubleAggregator}.
  * This class is generated. Do not edit it.
  */
-public final class TopListDoubleGroupingAggregatorFunction implements GroupingAggregatorFunction {
+public final class TopDoubleGroupingAggregatorFunction implements GroupingAggregatorFunction {
   private static final List<IntermediateStateDesc> INTERMEDIATE_STATE_DESC = List.of(
       new IntermediateStateDesc("topList", ElementType.DOUBLE)  );
 
-  private final TopListDoubleAggregator.GroupingState state;
+  private final TopDoubleAggregator.GroupingState state;
 
   private final List<Integer> channels;
 
@@ -36,9 +36,9 @@ public final class TopListDoubleGroupingAggregatorFunction implements GroupingAg
 
   private final boolean ascending;
 
-  public TopListDoubleGroupingAggregatorFunction(List<Integer> channels,
-      TopListDoubleAggregator.GroupingState state, DriverContext driverContext, int limit,
-      boolean ascending) {
+  public TopDoubleGroupingAggregatorFunction(List<Integer> channels,
+                                             TopDoubleAggregator.GroupingState state, DriverContext driverContext, int limit,
+                                             boolean ascending) {
     this.channels = channels;
     this.state = state;
     this.driverContext = driverContext;
@@ -46,9 +46,9 @@ public final class TopListDoubleGroupingAggregatorFunction implements GroupingAg
     this.ascending = ascending;
   }
 
-  public static TopListDoubleGroupingAggregatorFunction create(List<Integer> channels,
-      DriverContext driverContext, int limit, boolean ascending) {
-    return new TopListDoubleGroupingAggregatorFunction(channels, TopListDoubleAggregator.initGrouping(driverContext.bigArrays(), limit, ascending), driverContext, limit, ascending);
+  public static TopDoubleGroupingAggregatorFunction create(List<Integer> channels,
+                                                           DriverContext driverContext, int limit, boolean ascending) {
+    return new TopDoubleGroupingAggregatorFunction(channels, TopDoubleAggregator.initGrouping(driverContext.bigArrays(), limit, ascending), driverContext, limit, ascending);
   }
 
   public static List<IntermediateStateDesc> intermediateStateDesc() {
@@ -103,7 +103,7 @@ public final class TopListDoubleGroupingAggregatorFunction implements GroupingAg
       int valuesStart = values.getFirstValueIndex(groupPosition + positionOffset);
       int valuesEnd = valuesStart + values.getValueCount(groupPosition + positionOffset);
       for (int v = valuesStart; v < valuesEnd; v++) {
-        TopListDoubleAggregator.combine(state, groupId, values.getDouble(v));
+        TopDoubleAggregator.combine(state, groupId, values.getDouble(v));
       }
     }
   }
@@ -111,7 +111,7 @@ public final class TopListDoubleGroupingAggregatorFunction implements GroupingAg
   private void addRawInput(int positionOffset, IntVector groups, DoubleVector values) {
     for (int groupPosition = 0; groupPosition < groups.getPositionCount(); groupPosition++) {
       int groupId = Math.toIntExact(groups.getInt(groupPosition));
-      TopListDoubleAggregator.combine(state, groupId, values.getDouble(groupPosition + positionOffset));
+      TopDoubleAggregator.combine(state, groupId, values.getDouble(groupPosition + positionOffset));
     }
   }
 
@@ -130,7 +130,7 @@ public final class TopListDoubleGroupingAggregatorFunction implements GroupingAg
         int valuesStart = values.getFirstValueIndex(groupPosition + positionOffset);
         int valuesEnd = valuesStart + values.getValueCount(groupPosition + positionOffset);
         for (int v = valuesStart; v < valuesEnd; v++) {
-          TopListDoubleAggregator.combine(state, groupId, values.getDouble(v));
+          TopDoubleAggregator.combine(state, groupId, values.getDouble(v));
         }
       }
     }
@@ -145,7 +145,7 @@ public final class TopListDoubleGroupingAggregatorFunction implements GroupingAg
       int groupEnd = groupStart + groups.getValueCount(groupPosition);
       for (int g = groupStart; g < groupEnd; g++) {
         int groupId = Math.toIntExact(groups.getInt(g));
-        TopListDoubleAggregator.combine(state, groupId, values.getDouble(groupPosition + positionOffset));
+        TopDoubleAggregator.combine(state, groupId, values.getDouble(groupPosition + positionOffset));
       }
     }
   }
@@ -161,7 +161,7 @@ public final class TopListDoubleGroupingAggregatorFunction implements GroupingAg
     DoubleBlock topList = (DoubleBlock) topListUncast;
     for (int groupPosition = 0; groupPosition < groups.getPositionCount(); groupPosition++) {
       int groupId = Math.toIntExact(groups.getInt(groupPosition));
-      TopListDoubleAggregator.combineIntermediate(state, groupId, topList, groupPosition + positionOffset);
+      TopDoubleAggregator.combineIntermediate(state, groupId, topList, groupPosition + positionOffset);
     }
   }
 
@@ -170,9 +170,9 @@ public final class TopListDoubleGroupingAggregatorFunction implements GroupingAg
     if (input.getClass() != getClass()) {
       throw new IllegalArgumentException("expected " + getClass() + "; got " + input.getClass());
     }
-    TopListDoubleAggregator.GroupingState inState = ((TopListDoubleGroupingAggregatorFunction) input).state;
+    TopDoubleAggregator.GroupingState inState = ((TopDoubleGroupingAggregatorFunction) input).state;
     state.enableGroupIdTracking(new SeenGroupIds.Empty());
-    TopListDoubleAggregator.combineStates(state, groupId, inState, position);
+    TopDoubleAggregator.combineStates(state, groupId, inState, position);
   }
 
   @Override
@@ -183,7 +183,7 @@ public final class TopListDoubleGroupingAggregatorFunction implements GroupingAg
   @Override
   public void evaluateFinal(Block[] blocks, int offset, IntVector selected,
       DriverContext driverContext) {
-    blocks[offset] = TopListDoubleAggregator.evaluateFinal(state, selected, driverContext);
+    blocks[offset] = TopDoubleAggregator.evaluateFinal(state, selected, driverContext);
   }
 
   @Override

+ 12 - 12
x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopListFloatAggregatorFunction.java → x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopFloatAggregatorFunction.java

@@ -17,16 +17,16 @@ import org.elasticsearch.compute.data.Page;
 import org.elasticsearch.compute.operator.DriverContext;
 
 /**
- * {@link AggregatorFunction} implementation for {@link TopListFloatAggregator}.
+ * {@link AggregatorFunction} implementation for {@link TopFloatAggregator}.
  * This class is generated. Do not edit it.
  */
-public final class TopListFloatAggregatorFunction implements AggregatorFunction {
+public final class TopFloatAggregatorFunction implements AggregatorFunction {
   private static final List<IntermediateStateDesc> INTERMEDIATE_STATE_DESC = List.of(
       new IntermediateStateDesc("topList", ElementType.FLOAT)  );
 
   private final DriverContext driverContext;
 
-  private final TopListFloatAggregator.SingleState state;
+  private final TopFloatAggregator.SingleState state;
 
   private final List<Integer> channels;
 
@@ -34,8 +34,8 @@ public final class TopListFloatAggregatorFunction implements AggregatorFunction
 
   private final boolean ascending;
 
-  public TopListFloatAggregatorFunction(DriverContext driverContext, List<Integer> channels,
-      TopListFloatAggregator.SingleState state, int limit, boolean ascending) {
+  public TopFloatAggregatorFunction(DriverContext driverContext, List<Integer> channels,
+                                    TopFloatAggregator.SingleState state, int limit, boolean ascending) {
     this.driverContext = driverContext;
     this.channels = channels;
     this.state = state;
@@ -43,9 +43,9 @@ public final class TopListFloatAggregatorFunction implements AggregatorFunction
     this.ascending = ascending;
   }
 
-  public static TopListFloatAggregatorFunction create(DriverContext driverContext,
-      List<Integer> channels, int limit, boolean ascending) {
-    return new TopListFloatAggregatorFunction(driverContext, channels, TopListFloatAggregator.initSingle(driverContext.bigArrays(), limit, ascending), limit, ascending);
+  public static TopFloatAggregatorFunction create(DriverContext driverContext,
+                                                  List<Integer> channels, int limit, boolean ascending) {
+    return new TopFloatAggregatorFunction(driverContext, channels, TopFloatAggregator.initSingle(driverContext.bigArrays(), limit, ascending), limit, ascending);
   }
 
   public static List<IntermediateStateDesc> intermediateStateDesc() {
@@ -70,7 +70,7 @@ public final class TopListFloatAggregatorFunction implements AggregatorFunction
 
   private void addRawVector(FloatVector vector) {
     for (int i = 0; i < vector.getPositionCount(); i++) {
-      TopListFloatAggregator.combine(state, vector.getFloat(i));
+      TopFloatAggregator.combine(state, vector.getFloat(i));
     }
   }
 
@@ -82,7 +82,7 @@ public final class TopListFloatAggregatorFunction implements AggregatorFunction
       int start = block.getFirstValueIndex(p);
       int end = start + block.getValueCount(p);
       for (int i = start; i < end; i++) {
-        TopListFloatAggregator.combine(state, block.getFloat(i));
+        TopFloatAggregator.combine(state, block.getFloat(i));
       }
     }
   }
@@ -97,7 +97,7 @@ public final class TopListFloatAggregatorFunction implements AggregatorFunction
     }
     FloatBlock topList = (FloatBlock) topListUncast;
     assert topList.getPositionCount() == 1;
-    TopListFloatAggregator.combineIntermediate(state, topList);
+    TopFloatAggregator.combineIntermediate(state, topList);
   }
 
   @Override
@@ -107,7 +107,7 @@ public final class TopListFloatAggregatorFunction implements AggregatorFunction
 
   @Override
   public void evaluateFinal(Block[] blocks, int offset, DriverContext driverContext) {
-    blocks[offset] = TopListFloatAggregator.evaluateFinal(state, driverContext);
+    blocks[offset] = TopFloatAggregator.evaluateFinal(state, driverContext);
   }
 
   @Override

+ 9 - 9
x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopListFloatAggregatorFunctionSupplier.java → x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopFloatAggregatorFunctionSupplier.java

@@ -11,35 +11,35 @@ import java.util.List;
 import org.elasticsearch.compute.operator.DriverContext;
 
 /**
- * {@link AggregatorFunctionSupplier} implementation for {@link TopListFloatAggregator}.
+ * {@link AggregatorFunctionSupplier} implementation for {@link TopFloatAggregator}.
  * This class is generated. Do not edit it.
  */
-public final class TopListFloatAggregatorFunctionSupplier implements AggregatorFunctionSupplier {
+public final class TopFloatAggregatorFunctionSupplier implements AggregatorFunctionSupplier {
   private final List<Integer> channels;
 
   private final int limit;
 
   private final boolean ascending;
 
-  public TopListFloatAggregatorFunctionSupplier(List<Integer> channels, int limit,
-      boolean ascending) {
+  public TopFloatAggregatorFunctionSupplier(List<Integer> channels, int limit,
+                                            boolean ascending) {
     this.channels = channels;
     this.limit = limit;
     this.ascending = ascending;
   }
 
   @Override
-  public TopListFloatAggregatorFunction aggregator(DriverContext driverContext) {
-    return TopListFloatAggregatorFunction.create(driverContext, channels, limit, ascending);
+  public TopFloatAggregatorFunction aggregator(DriverContext driverContext) {
+    return TopFloatAggregatorFunction.create(driverContext, channels, limit, ascending);
   }
 
   @Override
-  public TopListFloatGroupingAggregatorFunction groupingAggregator(DriverContext driverContext) {
-    return TopListFloatGroupingAggregatorFunction.create(channels, driverContext, limit, ascending);
+  public TopFloatGroupingAggregatorFunction groupingAggregator(DriverContext driverContext) {
+    return TopFloatGroupingAggregatorFunction.create(channels, driverContext, limit, ascending);
   }
 
   @Override
   public String describe() {
-    return "top_list of floats";
+    return "top of floats";
   }
 }

+ 17 - 17
x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopListFloatGroupingAggregatorFunction.java → x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopFloatGroupingAggregatorFunction.java

@@ -19,14 +19,14 @@ import org.elasticsearch.compute.data.Page;
 import org.elasticsearch.compute.operator.DriverContext;
 
 /**
- * {@link GroupingAggregatorFunction} implementation for {@link TopListFloatAggregator}.
+ * {@link GroupingAggregatorFunction} implementation for {@link TopFloatAggregator}.
  * This class is generated. Do not edit it.
  */
-public final class TopListFloatGroupingAggregatorFunction implements GroupingAggregatorFunction {
+public final class TopFloatGroupingAggregatorFunction implements GroupingAggregatorFunction {
   private static final List<IntermediateStateDesc> INTERMEDIATE_STATE_DESC = List.of(
       new IntermediateStateDesc("topList", ElementType.FLOAT)  );
 
-  private final TopListFloatAggregator.GroupingState state;
+  private final TopFloatAggregator.GroupingState state;
 
   private final List<Integer> channels;
 
@@ -36,9 +36,9 @@ public final class TopListFloatGroupingAggregatorFunction implements GroupingAgg
 
   private final boolean ascending;
 
-  public TopListFloatGroupingAggregatorFunction(List<Integer> channels,
-      TopListFloatAggregator.GroupingState state, DriverContext driverContext, int limit,
-      boolean ascending) {
+  public TopFloatGroupingAggregatorFunction(List<Integer> channels,
+                                            TopFloatAggregator.GroupingState state, DriverContext driverContext, int limit,
+                                            boolean ascending) {
     this.channels = channels;
     this.state = state;
     this.driverContext = driverContext;
@@ -46,9 +46,9 @@ public final class TopListFloatGroupingAggregatorFunction implements GroupingAgg
     this.ascending = ascending;
   }
 
-  public static TopListFloatGroupingAggregatorFunction create(List<Integer> channels,
-      DriverContext driverContext, int limit, boolean ascending) {
-    return new TopListFloatGroupingAggregatorFunction(channels, TopListFloatAggregator.initGrouping(driverContext.bigArrays(), limit, ascending), driverContext, limit, ascending);
+  public static TopFloatGroupingAggregatorFunction create(List<Integer> channels,
+                                                          DriverContext driverContext, int limit, boolean ascending) {
+    return new TopFloatGroupingAggregatorFunction(channels, TopFloatAggregator.initGrouping(driverContext.bigArrays(), limit, ascending), driverContext, limit, ascending);
   }
 
   public static List<IntermediateStateDesc> intermediateStateDesc() {
@@ -103,7 +103,7 @@ public final class TopListFloatGroupingAggregatorFunction implements GroupingAgg
       int valuesStart = values.getFirstValueIndex(groupPosition + positionOffset);
       int valuesEnd = valuesStart + values.getValueCount(groupPosition + positionOffset);
       for (int v = valuesStart; v < valuesEnd; v++) {
-        TopListFloatAggregator.combine(state, groupId, values.getFloat(v));
+        TopFloatAggregator.combine(state, groupId, values.getFloat(v));
       }
     }
   }
@@ -111,7 +111,7 @@ public final class TopListFloatGroupingAggregatorFunction implements GroupingAgg
   private void addRawInput(int positionOffset, IntVector groups, FloatVector values) {
     for (int groupPosition = 0; groupPosition < groups.getPositionCount(); groupPosition++) {
       int groupId = Math.toIntExact(groups.getInt(groupPosition));
-      TopListFloatAggregator.combine(state, groupId, values.getFloat(groupPosition + positionOffset));
+      TopFloatAggregator.combine(state, groupId, values.getFloat(groupPosition + positionOffset));
     }
   }
 
@@ -130,7 +130,7 @@ public final class TopListFloatGroupingAggregatorFunction implements GroupingAgg
         int valuesStart = values.getFirstValueIndex(groupPosition + positionOffset);
         int valuesEnd = valuesStart + values.getValueCount(groupPosition + positionOffset);
         for (int v = valuesStart; v < valuesEnd; v++) {
-          TopListFloatAggregator.combine(state, groupId, values.getFloat(v));
+          TopFloatAggregator.combine(state, groupId, values.getFloat(v));
         }
       }
     }
@@ -145,7 +145,7 @@ public final class TopListFloatGroupingAggregatorFunction implements GroupingAgg
       int groupEnd = groupStart + groups.getValueCount(groupPosition);
       for (int g = groupStart; g < groupEnd; g++) {
         int groupId = Math.toIntExact(groups.getInt(g));
-        TopListFloatAggregator.combine(state, groupId, values.getFloat(groupPosition + positionOffset));
+        TopFloatAggregator.combine(state, groupId, values.getFloat(groupPosition + positionOffset));
       }
     }
   }
@@ -161,7 +161,7 @@ public final class TopListFloatGroupingAggregatorFunction implements GroupingAgg
     FloatBlock topList = (FloatBlock) topListUncast;
     for (int groupPosition = 0; groupPosition < groups.getPositionCount(); groupPosition++) {
       int groupId = Math.toIntExact(groups.getInt(groupPosition));
-      TopListFloatAggregator.combineIntermediate(state, groupId, topList, groupPosition + positionOffset);
+      TopFloatAggregator.combineIntermediate(state, groupId, topList, groupPosition + positionOffset);
     }
   }
 
@@ -170,9 +170,9 @@ public final class TopListFloatGroupingAggregatorFunction implements GroupingAgg
     if (input.getClass() != getClass()) {
       throw new IllegalArgumentException("expected " + getClass() + "; got " + input.getClass());
     }
-    TopListFloatAggregator.GroupingState inState = ((TopListFloatGroupingAggregatorFunction) input).state;
+    TopFloatAggregator.GroupingState inState = ((TopFloatGroupingAggregatorFunction) input).state;
     state.enableGroupIdTracking(new SeenGroupIds.Empty());
-    TopListFloatAggregator.combineStates(state, groupId, inState, position);
+    TopFloatAggregator.combineStates(state, groupId, inState, position);
   }
 
   @Override
@@ -183,7 +183,7 @@ public final class TopListFloatGroupingAggregatorFunction implements GroupingAgg
   @Override
   public void evaluateFinal(Block[] blocks, int offset, IntVector selected,
       DriverContext driverContext) {
-    blocks[offset] = TopListFloatAggregator.evaluateFinal(state, selected, driverContext);
+    blocks[offset] = TopFloatAggregator.evaluateFinal(state, selected, driverContext);
   }
 
   @Override

+ 12 - 12
x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopListIntAggregatorFunction.java → x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopIntAggregatorFunction.java

@@ -17,16 +17,16 @@ import org.elasticsearch.compute.data.Page;
 import org.elasticsearch.compute.operator.DriverContext;
 
 /**
- * {@link AggregatorFunction} implementation for {@link TopListIntAggregator}.
+ * {@link AggregatorFunction} implementation for {@link TopIntAggregator}.
  * This class is generated. Do not edit it.
  */
-public final class TopListIntAggregatorFunction implements AggregatorFunction {
+public final class TopIntAggregatorFunction implements AggregatorFunction {
   private static final List<IntermediateStateDesc> INTERMEDIATE_STATE_DESC = List.of(
       new IntermediateStateDesc("topList", ElementType.INT)  );
 
   private final DriverContext driverContext;
 
-  private final TopListIntAggregator.SingleState state;
+  private final TopIntAggregator.SingleState state;
 
   private final List<Integer> channels;
 
@@ -34,8 +34,8 @@ public final class TopListIntAggregatorFunction implements AggregatorFunction {
 
   private final boolean ascending;
 
-  public TopListIntAggregatorFunction(DriverContext driverContext, List<Integer> channels,
-      TopListIntAggregator.SingleState state, int limit, boolean ascending) {
+  public TopIntAggregatorFunction(DriverContext driverContext, List<Integer> channels,
+                                  TopIntAggregator.SingleState state, int limit, boolean ascending) {
     this.driverContext = driverContext;
     this.channels = channels;
     this.state = state;
@@ -43,9 +43,9 @@ public final class TopListIntAggregatorFunction implements AggregatorFunction {
     this.ascending = ascending;
   }
 
-  public static TopListIntAggregatorFunction create(DriverContext driverContext,
-      List<Integer> channels, int limit, boolean ascending) {
-    return new TopListIntAggregatorFunction(driverContext, channels, TopListIntAggregator.initSingle(driverContext.bigArrays(), limit, ascending), limit, ascending);
+  public static TopIntAggregatorFunction create(DriverContext driverContext,
+                                                List<Integer> channels, int limit, boolean ascending) {
+    return new TopIntAggregatorFunction(driverContext, channels, TopIntAggregator.initSingle(driverContext.bigArrays(), limit, ascending), limit, ascending);
   }
 
   public static List<IntermediateStateDesc> intermediateStateDesc() {
@@ -70,7 +70,7 @@ public final class TopListIntAggregatorFunction implements AggregatorFunction {
 
   private void addRawVector(IntVector vector) {
     for (int i = 0; i < vector.getPositionCount(); i++) {
-      TopListIntAggregator.combine(state, vector.getInt(i));
+      TopIntAggregator.combine(state, vector.getInt(i));
     }
   }
 
@@ -82,7 +82,7 @@ public final class TopListIntAggregatorFunction implements AggregatorFunction {
       int start = block.getFirstValueIndex(p);
       int end = start + block.getValueCount(p);
       for (int i = start; i < end; i++) {
-        TopListIntAggregator.combine(state, block.getInt(i));
+        TopIntAggregator.combine(state, block.getInt(i));
       }
     }
   }
@@ -97,7 +97,7 @@ public final class TopListIntAggregatorFunction implements AggregatorFunction {
     }
     IntBlock topList = (IntBlock) topListUncast;
     assert topList.getPositionCount() == 1;
-    TopListIntAggregator.combineIntermediate(state, topList);
+    TopIntAggregator.combineIntermediate(state, topList);
   }
 
   @Override
@@ -107,7 +107,7 @@ public final class TopListIntAggregatorFunction implements AggregatorFunction {
 
   @Override
   public void evaluateFinal(Block[] blocks, int offset, DriverContext driverContext) {
-    blocks[offset] = TopListIntAggregator.evaluateFinal(state, driverContext);
+    blocks[offset] = TopIntAggregator.evaluateFinal(state, driverContext);
   }
 
   @Override

+ 9 - 9
x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopListIntAggregatorFunctionSupplier.java → x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopIntAggregatorFunctionSupplier.java

@@ -11,35 +11,35 @@ import java.util.List;
 import org.elasticsearch.compute.operator.DriverContext;
 
 /**
- * {@link AggregatorFunctionSupplier} implementation for {@link TopListIntAggregator}.
+ * {@link AggregatorFunctionSupplier} implementation for {@link TopIntAggregator}.
  * This class is generated. Do not edit it.
  */
-public final class TopListIntAggregatorFunctionSupplier implements AggregatorFunctionSupplier {
+public final class TopIntAggregatorFunctionSupplier implements AggregatorFunctionSupplier {
   private final List<Integer> channels;
 
   private final int limit;
 
   private final boolean ascending;
 
-  public TopListIntAggregatorFunctionSupplier(List<Integer> channels, int limit,
-      boolean ascending) {
+  public TopIntAggregatorFunctionSupplier(List<Integer> channels, int limit,
+                                          boolean ascending) {
     this.channels = channels;
     this.limit = limit;
     this.ascending = ascending;
   }
 
   @Override
-  public TopListIntAggregatorFunction aggregator(DriverContext driverContext) {
-    return TopListIntAggregatorFunction.create(driverContext, channels, limit, ascending);
+  public TopIntAggregatorFunction aggregator(DriverContext driverContext) {
+    return TopIntAggregatorFunction.create(driverContext, channels, limit, ascending);
   }
 
   @Override
-  public TopListIntGroupingAggregatorFunction groupingAggregator(DriverContext driverContext) {
-    return TopListIntGroupingAggregatorFunction.create(channels, driverContext, limit, ascending);
+  public TopIntGroupingAggregatorFunction groupingAggregator(DriverContext driverContext) {
+    return TopIntGroupingAggregatorFunction.create(channels, driverContext, limit, ascending);
   }
 
   @Override
   public String describe() {
-    return "top_list of ints";
+    return "top of ints";
   }
 }

+ 17 - 17
x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopListIntGroupingAggregatorFunction.java → x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopIntGroupingAggregatorFunction.java

@@ -17,14 +17,14 @@ import org.elasticsearch.compute.data.Page;
 import org.elasticsearch.compute.operator.DriverContext;
 
 /**
- * {@link GroupingAggregatorFunction} implementation for {@link TopListIntAggregator}.
+ * {@link GroupingAggregatorFunction} implementation for {@link TopIntAggregator}.
  * This class is generated. Do not edit it.
  */
-public final class TopListIntGroupingAggregatorFunction implements GroupingAggregatorFunction {
+public final class TopIntGroupingAggregatorFunction implements GroupingAggregatorFunction {
   private static final List<IntermediateStateDesc> INTERMEDIATE_STATE_DESC = List.of(
       new IntermediateStateDesc("topList", ElementType.INT)  );
 
-  private final TopListIntAggregator.GroupingState state;
+  private final TopIntAggregator.GroupingState state;
 
   private final List<Integer> channels;
 
@@ -34,9 +34,9 @@ public final class TopListIntGroupingAggregatorFunction implements GroupingAggre
 
   private final boolean ascending;
 
-  public TopListIntGroupingAggregatorFunction(List<Integer> channels,
-      TopListIntAggregator.GroupingState state, DriverContext driverContext, int limit,
-      boolean ascending) {
+  public TopIntGroupingAggregatorFunction(List<Integer> channels,
+                                          TopIntAggregator.GroupingState state, DriverContext driverContext, int limit,
+                                          boolean ascending) {
     this.channels = channels;
     this.state = state;
     this.driverContext = driverContext;
@@ -44,9 +44,9 @@ public final class TopListIntGroupingAggregatorFunction implements GroupingAggre
     this.ascending = ascending;
   }
 
-  public static TopListIntGroupingAggregatorFunction create(List<Integer> channels,
-      DriverContext driverContext, int limit, boolean ascending) {
-    return new TopListIntGroupingAggregatorFunction(channels, TopListIntAggregator.initGrouping(driverContext.bigArrays(), limit, ascending), driverContext, limit, ascending);
+  public static TopIntGroupingAggregatorFunction create(List<Integer> channels,
+                                                        DriverContext driverContext, int limit, boolean ascending) {
+    return new TopIntGroupingAggregatorFunction(channels, TopIntAggregator.initGrouping(driverContext.bigArrays(), limit, ascending), driverContext, limit, ascending);
   }
 
   public static List<IntermediateStateDesc> intermediateStateDesc() {
@@ -101,7 +101,7 @@ public final class TopListIntGroupingAggregatorFunction implements GroupingAggre
       int valuesStart = values.getFirstValueIndex(groupPosition + positionOffset);
       int valuesEnd = valuesStart + values.getValueCount(groupPosition + positionOffset);
       for (int v = valuesStart; v < valuesEnd; v++) {
-        TopListIntAggregator.combine(state, groupId, values.getInt(v));
+        TopIntAggregator.combine(state, groupId, values.getInt(v));
       }
     }
   }
@@ -109,7 +109,7 @@ public final class TopListIntGroupingAggregatorFunction implements GroupingAggre
   private void addRawInput(int positionOffset, IntVector groups, IntVector values) {
     for (int groupPosition = 0; groupPosition < groups.getPositionCount(); groupPosition++) {
       int groupId = Math.toIntExact(groups.getInt(groupPosition));
-      TopListIntAggregator.combine(state, groupId, values.getInt(groupPosition + positionOffset));
+      TopIntAggregator.combine(state, groupId, values.getInt(groupPosition + positionOffset));
     }
   }
 
@@ -128,7 +128,7 @@ public final class TopListIntGroupingAggregatorFunction implements GroupingAggre
         int valuesStart = values.getFirstValueIndex(groupPosition + positionOffset);
         int valuesEnd = valuesStart + values.getValueCount(groupPosition + positionOffset);
         for (int v = valuesStart; v < valuesEnd; v++) {
-          TopListIntAggregator.combine(state, groupId, values.getInt(v));
+          TopIntAggregator.combine(state, groupId, values.getInt(v));
         }
       }
     }
@@ -143,7 +143,7 @@ public final class TopListIntGroupingAggregatorFunction implements GroupingAggre
       int groupEnd = groupStart + groups.getValueCount(groupPosition);
       for (int g = groupStart; g < groupEnd; g++) {
         int groupId = Math.toIntExact(groups.getInt(g));
-        TopListIntAggregator.combine(state, groupId, values.getInt(groupPosition + positionOffset));
+        TopIntAggregator.combine(state, groupId, values.getInt(groupPosition + positionOffset));
       }
     }
   }
@@ -159,7 +159,7 @@ public final class TopListIntGroupingAggregatorFunction implements GroupingAggre
     IntBlock topList = (IntBlock) topListUncast;
     for (int groupPosition = 0; groupPosition < groups.getPositionCount(); groupPosition++) {
       int groupId = Math.toIntExact(groups.getInt(groupPosition));
-      TopListIntAggregator.combineIntermediate(state, groupId, topList, groupPosition + positionOffset);
+      TopIntAggregator.combineIntermediate(state, groupId, topList, groupPosition + positionOffset);
     }
   }
 
@@ -168,9 +168,9 @@ public final class TopListIntGroupingAggregatorFunction implements GroupingAggre
     if (input.getClass() != getClass()) {
       throw new IllegalArgumentException("expected " + getClass() + "; got " + input.getClass());
     }
-    TopListIntAggregator.GroupingState inState = ((TopListIntGroupingAggregatorFunction) input).state;
+    TopIntAggregator.GroupingState inState = ((TopIntGroupingAggregatorFunction) input).state;
     state.enableGroupIdTracking(new SeenGroupIds.Empty());
-    TopListIntAggregator.combineStates(state, groupId, inState, position);
+    TopIntAggregator.combineStates(state, groupId, inState, position);
   }
 
   @Override
@@ -181,7 +181,7 @@ public final class TopListIntGroupingAggregatorFunction implements GroupingAggre
   @Override
   public void evaluateFinal(Block[] blocks, int offset, IntVector selected,
       DriverContext driverContext) {
-    blocks[offset] = TopListIntAggregator.evaluateFinal(state, selected, driverContext);
+    blocks[offset] = TopIntAggregator.evaluateFinal(state, selected, driverContext);
   }
 
   @Override

+ 12 - 12
x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopListLongAggregatorFunction.java → x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopLongAggregatorFunction.java

@@ -17,16 +17,16 @@ import org.elasticsearch.compute.data.Page;
 import org.elasticsearch.compute.operator.DriverContext;
 
 /**
- * {@link AggregatorFunction} implementation for {@link TopListLongAggregator}.
+ * {@link AggregatorFunction} implementation for {@link TopLongAggregator}.
  * This class is generated. Do not edit it.
  */
-public final class TopListLongAggregatorFunction implements AggregatorFunction {
+public final class TopLongAggregatorFunction implements AggregatorFunction {
   private static final List<IntermediateStateDesc> INTERMEDIATE_STATE_DESC = List.of(
       new IntermediateStateDesc("topList", ElementType.LONG)  );
 
   private final DriverContext driverContext;
 
-  private final TopListLongAggregator.SingleState state;
+  private final TopLongAggregator.SingleState state;
 
   private final List<Integer> channels;
 
@@ -34,8 +34,8 @@ public final class TopListLongAggregatorFunction implements AggregatorFunction {
 
   private final boolean ascending;
 
-  public TopListLongAggregatorFunction(DriverContext driverContext, List<Integer> channels,
-      TopListLongAggregator.SingleState state, int limit, boolean ascending) {
+  public TopLongAggregatorFunction(DriverContext driverContext, List<Integer> channels,
+                                   TopLongAggregator.SingleState state, int limit, boolean ascending) {
     this.driverContext = driverContext;
     this.channels = channels;
     this.state = state;
@@ -43,9 +43,9 @@ public final class TopListLongAggregatorFunction implements AggregatorFunction {
     this.ascending = ascending;
   }
 
-  public static TopListLongAggregatorFunction create(DriverContext driverContext,
-      List<Integer> channels, int limit, boolean ascending) {
-    return new TopListLongAggregatorFunction(driverContext, channels, TopListLongAggregator.initSingle(driverContext.bigArrays(), limit, ascending), limit, ascending);
+  public static TopLongAggregatorFunction create(DriverContext driverContext,
+                                                 List<Integer> channels, int limit, boolean ascending) {
+    return new TopLongAggregatorFunction(driverContext, channels, TopLongAggregator.initSingle(driverContext.bigArrays(), limit, ascending), limit, ascending);
   }
 
   public static List<IntermediateStateDesc> intermediateStateDesc() {
@@ -70,7 +70,7 @@ public final class TopListLongAggregatorFunction implements AggregatorFunction {
 
   private void addRawVector(LongVector vector) {
     for (int i = 0; i < vector.getPositionCount(); i++) {
-      TopListLongAggregator.combine(state, vector.getLong(i));
+      TopLongAggregator.combine(state, vector.getLong(i));
     }
   }
 
@@ -82,7 +82,7 @@ public final class TopListLongAggregatorFunction implements AggregatorFunction {
       int start = block.getFirstValueIndex(p);
       int end = start + block.getValueCount(p);
       for (int i = start; i < end; i++) {
-        TopListLongAggregator.combine(state, block.getLong(i));
+        TopLongAggregator.combine(state, block.getLong(i));
       }
     }
   }
@@ -97,7 +97,7 @@ public final class TopListLongAggregatorFunction implements AggregatorFunction {
     }
     LongBlock topList = (LongBlock) topListUncast;
     assert topList.getPositionCount() == 1;
-    TopListLongAggregator.combineIntermediate(state, topList);
+    TopLongAggregator.combineIntermediate(state, topList);
   }
 
   @Override
@@ -107,7 +107,7 @@ public final class TopListLongAggregatorFunction implements AggregatorFunction {
 
   @Override
   public void evaluateFinal(Block[] blocks, int offset, DriverContext driverContext) {
-    blocks[offset] = TopListLongAggregator.evaluateFinal(state, driverContext);
+    blocks[offset] = TopLongAggregator.evaluateFinal(state, driverContext);
   }
 
   @Override

+ 9 - 9
x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopListLongAggregatorFunctionSupplier.java → x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopLongAggregatorFunctionSupplier.java

@@ -11,35 +11,35 @@ import java.util.List;
 import org.elasticsearch.compute.operator.DriverContext;
 
 /**
- * {@link AggregatorFunctionSupplier} implementation for {@link TopListLongAggregator}.
+ * {@link AggregatorFunctionSupplier} implementation for {@link TopLongAggregator}.
  * This class is generated. Do not edit it.
  */
-public final class TopListLongAggregatorFunctionSupplier implements AggregatorFunctionSupplier {
+public final class TopLongAggregatorFunctionSupplier implements AggregatorFunctionSupplier {
   private final List<Integer> channels;
 
   private final int limit;
 
   private final boolean ascending;
 
-  public TopListLongAggregatorFunctionSupplier(List<Integer> channels, int limit,
-      boolean ascending) {
+  public TopLongAggregatorFunctionSupplier(List<Integer> channels, int limit,
+                                           boolean ascending) {
     this.channels = channels;
     this.limit = limit;
     this.ascending = ascending;
   }
 
   @Override
-  public TopListLongAggregatorFunction aggregator(DriverContext driverContext) {
-    return TopListLongAggregatorFunction.create(driverContext, channels, limit, ascending);
+  public TopLongAggregatorFunction aggregator(DriverContext driverContext) {
+    return TopLongAggregatorFunction.create(driverContext, channels, limit, ascending);
   }
 
   @Override
-  public TopListLongGroupingAggregatorFunction groupingAggregator(DriverContext driverContext) {
-    return TopListLongGroupingAggregatorFunction.create(channels, driverContext, limit, ascending);
+  public TopLongGroupingAggregatorFunction groupingAggregator(DriverContext driverContext) {
+    return TopLongGroupingAggregatorFunction.create(channels, driverContext, limit, ascending);
   }
 
   @Override
   public String describe() {
-    return "top_list of longs";
+    return "top of longs";
   }
 }

+ 17 - 17
x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopListLongGroupingAggregatorFunction.java → x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopLongGroupingAggregatorFunction.java

@@ -19,14 +19,14 @@ import org.elasticsearch.compute.data.Page;
 import org.elasticsearch.compute.operator.DriverContext;
 
 /**
- * {@link GroupingAggregatorFunction} implementation for {@link TopListLongAggregator}.
+ * {@link GroupingAggregatorFunction} implementation for {@link TopLongAggregator}.
  * This class is generated. Do not edit it.
  */
-public final class TopListLongGroupingAggregatorFunction implements GroupingAggregatorFunction {
+public final class TopLongGroupingAggregatorFunction implements GroupingAggregatorFunction {
   private static final List<IntermediateStateDesc> INTERMEDIATE_STATE_DESC = List.of(
       new IntermediateStateDesc("topList", ElementType.LONG)  );
 
-  private final TopListLongAggregator.GroupingState state;
+  private final TopLongAggregator.GroupingState state;
 
   private final List<Integer> channels;
 
@@ -36,9 +36,9 @@ public final class TopListLongGroupingAggregatorFunction implements GroupingAggr
 
   private final boolean ascending;
 
-  public TopListLongGroupingAggregatorFunction(List<Integer> channels,
-      TopListLongAggregator.GroupingState state, DriverContext driverContext, int limit,
-      boolean ascending) {
+  public TopLongGroupingAggregatorFunction(List<Integer> channels,
+                                           TopLongAggregator.GroupingState state, DriverContext driverContext, int limit,
+                                           boolean ascending) {
     this.channels = channels;
     this.state = state;
     this.driverContext = driverContext;
@@ -46,9 +46,9 @@ public final class TopListLongGroupingAggregatorFunction implements GroupingAggr
     this.ascending = ascending;
   }
 
-  public static TopListLongGroupingAggregatorFunction create(List<Integer> channels,
-      DriverContext driverContext, int limit, boolean ascending) {
-    return new TopListLongGroupingAggregatorFunction(channels, TopListLongAggregator.initGrouping(driverContext.bigArrays(), limit, ascending), driverContext, limit, ascending);
+  public static TopLongGroupingAggregatorFunction create(List<Integer> channels,
+                                                         DriverContext driverContext, int limit, boolean ascending) {
+    return new TopLongGroupingAggregatorFunction(channels, TopLongAggregator.initGrouping(driverContext.bigArrays(), limit, ascending), driverContext, limit, ascending);
   }
 
   public static List<IntermediateStateDesc> intermediateStateDesc() {
@@ -103,7 +103,7 @@ public final class TopListLongGroupingAggregatorFunction implements GroupingAggr
       int valuesStart = values.getFirstValueIndex(groupPosition + positionOffset);
       int valuesEnd = valuesStart + values.getValueCount(groupPosition + positionOffset);
       for (int v = valuesStart; v < valuesEnd; v++) {
-        TopListLongAggregator.combine(state, groupId, values.getLong(v));
+        TopLongAggregator.combine(state, groupId, values.getLong(v));
       }
     }
   }
@@ -111,7 +111,7 @@ public final class TopListLongGroupingAggregatorFunction implements GroupingAggr
   private void addRawInput(int positionOffset, IntVector groups, LongVector values) {
     for (int groupPosition = 0; groupPosition < groups.getPositionCount(); groupPosition++) {
       int groupId = Math.toIntExact(groups.getInt(groupPosition));
-      TopListLongAggregator.combine(state, groupId, values.getLong(groupPosition + positionOffset));
+      TopLongAggregator.combine(state, groupId, values.getLong(groupPosition + positionOffset));
     }
   }
 
@@ -130,7 +130,7 @@ public final class TopListLongGroupingAggregatorFunction implements GroupingAggr
         int valuesStart = values.getFirstValueIndex(groupPosition + positionOffset);
         int valuesEnd = valuesStart + values.getValueCount(groupPosition + positionOffset);
         for (int v = valuesStart; v < valuesEnd; v++) {
-          TopListLongAggregator.combine(state, groupId, values.getLong(v));
+          TopLongAggregator.combine(state, groupId, values.getLong(v));
         }
       }
     }
@@ -145,7 +145,7 @@ public final class TopListLongGroupingAggregatorFunction implements GroupingAggr
       int groupEnd = groupStart + groups.getValueCount(groupPosition);
       for (int g = groupStart; g < groupEnd; g++) {
         int groupId = Math.toIntExact(groups.getInt(g));
-        TopListLongAggregator.combine(state, groupId, values.getLong(groupPosition + positionOffset));
+        TopLongAggregator.combine(state, groupId, values.getLong(groupPosition + positionOffset));
       }
     }
   }
@@ -161,7 +161,7 @@ public final class TopListLongGroupingAggregatorFunction implements GroupingAggr
     LongBlock topList = (LongBlock) topListUncast;
     for (int groupPosition = 0; groupPosition < groups.getPositionCount(); groupPosition++) {
       int groupId = Math.toIntExact(groups.getInt(groupPosition));
-      TopListLongAggregator.combineIntermediate(state, groupId, topList, groupPosition + positionOffset);
+      TopLongAggregator.combineIntermediate(state, groupId, topList, groupPosition + positionOffset);
     }
   }
 
@@ -170,9 +170,9 @@ public final class TopListLongGroupingAggregatorFunction implements GroupingAggr
     if (input.getClass() != getClass()) {
       throw new IllegalArgumentException("expected " + getClass() + "; got " + input.getClass());
     }
-    TopListLongAggregator.GroupingState inState = ((TopListLongGroupingAggregatorFunction) input).state;
+    TopLongAggregator.GroupingState inState = ((TopLongGroupingAggregatorFunction) input).state;
     state.enableGroupIdTracking(new SeenGroupIds.Empty());
-    TopListLongAggregator.combineStates(state, groupId, inState, position);
+    TopLongAggregator.combineStates(state, groupId, inState, position);
   }
 
   @Override
@@ -183,7 +183,7 @@ public final class TopListLongGroupingAggregatorFunction implements GroupingAggr
   @Override
   public void evaluateFinal(Block[] blocks, int offset, IntVector selected,
       DriverContext driverContext) {
-    blocks[offset] = TopListLongAggregator.evaluateFinal(state, selected, driverContext);
+    blocks[offset] = TopLongAggregator.evaluateFinal(state, selected, driverContext);
   }
 
   @Override

+ 2 - 2
x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/X-TopListAggregator.java.st → x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/X-TopAggregator.java.st

@@ -29,9 +29,9 @@ import org.elasticsearch.search.sort.SortOrder;
 /**
  * Aggregates the top N field values for $type$.
  */
-@Aggregator({ @IntermediateState(name = "topList", type = "$TYPE$_BLOCK") })
+@Aggregator({ @IntermediateState(name = "top", type = "$TYPE$_BLOCK") })
 @GroupingAggregator
-class TopList$Type$Aggregator {
+class Top$Type$Aggregator {
     public static SingleState initSingle(BigArrays bigArrays, int limit, boolean ascending) {
         return new SingleState(bigArrays, limit, ascending);
     }

+ 3 - 3
x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/aggregation/TopListDoubleAggregatorFunctionTests.java → x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/aggregation/TopDoubleAggregatorFunctionTests.java

@@ -18,7 +18,7 @@ import java.util.stream.IntStream;
 
 import static org.hamcrest.Matchers.contains;
 
-public class TopListDoubleAggregatorFunctionTests extends AggregatorFunctionTestCase {
+public class TopDoubleAggregatorFunctionTests extends AggregatorFunctionTestCase {
     private static final int LIMIT = 100;
 
     @Override
@@ -28,12 +28,12 @@ public class TopListDoubleAggregatorFunctionTests extends AggregatorFunctionTest
 
     @Override
     protected AggregatorFunctionSupplier aggregatorFunction(List<Integer> inputChannels) {
-        return new TopListDoubleAggregatorFunctionSupplier(inputChannels, LIMIT, true);
+        return new TopDoubleAggregatorFunctionSupplier(inputChannels, LIMIT, true);
     }
 
     @Override
     protected String expectedDescriptionOfAggregator() {
-        return "top_list of doubles";
+        return "top of doubles";
     }
 
     @Override

+ 3 - 3
x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/aggregation/TopListFloatAggregatorFunctionTests.java → x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/aggregation/TopFloatAggregatorFunctionTests.java

@@ -18,7 +18,7 @@ import java.util.stream.IntStream;
 
 import static org.hamcrest.Matchers.contains;
 
-public class TopListFloatAggregatorFunctionTests extends AggregatorFunctionTestCase {
+public class TopFloatAggregatorFunctionTests extends AggregatorFunctionTestCase {
     private static final int LIMIT = 100;
 
     @Override
@@ -28,12 +28,12 @@ public class TopListFloatAggregatorFunctionTests extends AggregatorFunctionTestC
 
     @Override
     protected AggregatorFunctionSupplier aggregatorFunction(List<Integer> inputChannels) {
-        return new TopListFloatAggregatorFunctionSupplier(inputChannels, LIMIT, true);
+        return new TopFloatAggregatorFunctionSupplier(inputChannels, LIMIT, true);
     }
 
     @Override
     protected String expectedDescriptionOfAggregator() {
-        return "top_list of floats";
+        return "top of floats";
     }
 
     @Override

+ 3 - 3
x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/aggregation/TopListIntAggregatorFunctionTests.java → x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/aggregation/TopIntAggregatorFunctionTests.java

@@ -18,7 +18,7 @@ import java.util.stream.IntStream;
 
 import static org.hamcrest.Matchers.contains;
 
-public class TopListIntAggregatorFunctionTests extends AggregatorFunctionTestCase {
+public class TopIntAggregatorFunctionTests extends AggregatorFunctionTestCase {
     private static final int LIMIT = 100;
 
     @Override
@@ -28,12 +28,12 @@ public class TopListIntAggregatorFunctionTests extends AggregatorFunctionTestCas
 
     @Override
     protected AggregatorFunctionSupplier aggregatorFunction(List<Integer> inputChannels) {
-        return new TopListIntAggregatorFunctionSupplier(inputChannels, LIMIT, true);
+        return new TopIntAggregatorFunctionSupplier(inputChannels, LIMIT, true);
     }
 
     @Override
     protected String expectedDescriptionOfAggregator() {
-        return "top_list of ints";
+        return "top of ints";
     }
 
     @Override

+ 3 - 3
x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/aggregation/TopListLongAggregatorFunctionTests.java → x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/aggregation/TopLongAggregatorFunctionTests.java

@@ -18,7 +18,7 @@ import java.util.stream.LongStream;
 
 import static org.hamcrest.Matchers.contains;
 
-public class TopListLongAggregatorFunctionTests extends AggregatorFunctionTestCase {
+public class TopLongAggregatorFunctionTests extends AggregatorFunctionTestCase {
     private static final int LIMIT = 100;
 
     @Override
@@ -28,12 +28,12 @@ public class TopListLongAggregatorFunctionTests extends AggregatorFunctionTestCa
 
     @Override
     protected AggregatorFunctionSupplier aggregatorFunction(List<Integer> inputChannels) {
-        return new TopListLongAggregatorFunctionSupplier(inputChannels, LIMIT, true);
+        return new TopLongAggregatorFunctionSupplier(inputChannels, LIMIT, true);
     }
 
     @Override
     protected String expectedDescriptionOfAggregator() {
-        return "top_list of longs";
+        return "top of longs";
     }
 
     @Override

+ 4 - 4
x-pack/plugin/esql/qa/testFixtures/src/main/resources/meta.csv-spec

@@ -110,7 +110,7 @@ double tau()
 "keyword|text to_upper(str:keyword|text)"
 "version to_ver(field:keyword|text|version)"
 "version to_version(field:keyword|text|version)"
-"double|integer|long|date top_list(field:double|integer|long|date, limit:integer, order:keyword)"
+"double|integer|long|date top(field:double|integer|long|date, limit:integer, order:keyword)"
 "keyword|text trim(string:keyword|text)"
 "boolean|date|double|integer|ip|keyword|long|text|version values(field:boolean|date|double|integer|ip|keyword|long|text|version)"
 ;
@@ -229,7 +229,7 @@ to_unsigned_lo|field                               |"boolean|date|keyword|text|d
 to_upper      |str                                 |"keyword|text"                                                                                                                    |String expression. If `null`, the function returns `null`.
 to_ver        |field                               |"keyword|text|version"                                                                                                            |Input value. The input can be a single- or multi-valued column or an expression.
 to_version    |field                               |"keyword|text|version"                                                                                                            |Input value. The input can be a single- or multi-valued column or an expression.
-top_list      |[field, limit, order]               |["double|integer|long|date", integer, keyword]                                                                                    |[The field to collect the top values for.,The maximum number of values to collect.,The order to calculate the top values. Either `asc` or `desc`.]
+top      |[field, limit, order]               |["double|integer|long|date", integer, keyword]                                                                                    |[The field to collect the top values for.,The maximum number of values to collect.,The order to calculate the top values. Either `asc` or `desc`.]
 trim          |string                              |"keyword|text"                                                                                                                    |String expression. If `null`, the function returns `null`.
 values        |field                               |"boolean|date|double|integer|ip|keyword|long|text|version"                                                                        |[""]
 ;
@@ -349,7 +349,7 @@ to_unsigned_lo|Converts an input value to an unsigned long value. If the input p
 to_upper      |Returns a new string representing the input string converted to upper case.
 to_ver        |Converts an input string to a version value.
 to_version    |Converts an input string to a version value.
-top_list      |Collects the top values for a field. Includes repeated values.
+top      |Collects the top values for a field. Includes repeated values.
 trim          |Removes leading and trailing whitespaces from a string.
 values        |Collect values for a field.
 ;
@@ -470,7 +470,7 @@ to_unsigned_lo|unsigned_long
 to_upper      |"keyword|text"                                                                                                              |false                       |false           |false
 to_ver        |version                                                                                                                     |false                       |false           |false
 to_version    |version                                                                                                                     |false                       |false           |false
-top_list      |"double|integer|long|date"                                                                                                  |[false, false, false]       |false           |true
+top      |"double|integer|long|date"                                                                                                  |[false, false, false]       |false           |true
 trim          |"keyword|text"                                                                                                              |false                       |false           |false
 values        |"boolean|date|double|integer|ip|keyword|long|text|version"                                                                  |false                       |false           |true
 ;

+ 156 - 0
x-pack/plugin/esql/qa/testFixtures/src/main/resources/stats_top.csv-spec

@@ -0,0 +1,156 @@
+top
+required_capability: agg_top
+// tag::top[]
+FROM employees
+| STATS top_salaries = TOP(salary, 3, "desc"), top_salary = MAX(salary)
+// end::top[]
+;
+
+// tag::top-result[]
+top_salaries:integer | top_salary:integer
+[74999, 74970, 74572] | 74999
+// end::top-result[]
+;
+
+topAllTypesAsc
+required_capability: agg_top
+FROM employees
+| STATS
+    date = TOP(hire_date, 2, "asc"),
+    double = TOP(salary_change, 2, "asc"),
+    integer = TOP(salary, 2, "asc"),
+    long = TOP(salary_change.long, 2, "asc")
+;
+
+date:date | double:double | integer:integer | long:long
+[1985-02-18T00:00:00.000Z,1985-02-24T00:00:00.000Z] | [-9.81,-9.28] | [25324,25945] | [-9,-9]
+;
+
+topAllTypesDesc
+required_capability: agg_top
+FROM employees
+| STATS
+    date = TOP(hire_date, 2, "desc"),
+    double = TOP(salary_change, 2, "desc"),
+    integer = TOP(salary, 2, "desc"),
+    long = TOP(salary_change.long, 2, "desc")
+;
+
+date:date | double:double | integer:integer | long:long
+[1999-04-30T00:00:00.000Z,1997-05-19T00:00:00.000Z] | [14.74,14.68] | [74999,74970] | [14,14]
+;
+
+topAllTypesRow
+required_capability: agg_top
+ROW
+    constant_date=TO_DATETIME("1985-02-18T00:00:00.000Z"),
+    constant_double=-9.81,
+    constant_integer=25324,
+    constant_long=TO_LONG(-9)
+| STATS
+    date = TOP(constant_date, 2, "asc"),
+    double = TOP(constant_double, 2, "asc"),
+    integer = TOP(constant_integer, 2, "asc"),
+    long = TOP(constant_long, 2, "asc")
+| keep date, double, integer, long
+;
+
+date:date                | double:double | integer:integer | long:long
+1985-02-18T00:00:00.000Z | -9.81         | 25324           | -9
+;
+
+topSomeBuckets
+required_capability: agg_top
+FROM employees
+| STATS top_salary = TOP(salary, 2, "desc") by still_hired
+| sort still_hired asc
+;
+
+top_salary:integer | still_hired:boolean
+[74999,74970]      | false
+[74572,73578]      | true
+;
+
+topManyBuckets
+required_capability: agg_top
+FROM employees
+| STATS top_salary = TOP(salary, 2, "desc") by x=emp_no, y=emp_no+1
+| sort x asc
+| limit 3
+;
+
+top_salary:integer | x:integer | y:integer
+57305              | 10001     | 10002
+56371              | 10002     | 10003
+61805              | 10003     | 10004
+;
+
+topMultipleStats
+required_capability: agg_top
+FROM employees
+| STATS top_salary = TOP(salary, 1, "desc") by emp_no
+| STATS top_salary = TOP(top_salary, 3, "asc")
+;
+
+top_salary:integer
+[25324,25945,25976]
+;
+
+topAllTypesMin
+required_capability: agg_top
+FROM employees
+| STATS
+    date = TOP(hire_date, 1, "asc"),
+    double = TOP(salary_change, 1, "asc"),
+    integer = TOP(salary, 1, "asc"),
+    long = TOP(salary_change.long, 1, "asc")
+;
+
+date:date | double:double | integer:integer | long:long
+1985-02-18T00:00:00.000Z | -9.81 | 25324 | -9
+;
+
+topAllTypesMax
+required_capability: agg_top
+FROM employees
+| STATS
+    date = TOP(hire_date, 1, "desc"),
+    double = TOP(salary_change, 1, "desc"),
+    integer = TOP(salary, 1, "desc"),
+    long = TOP(salary_change.long, 1, "desc")
+;
+
+date:date | double:double | integer:integer | long:long
+1999-04-30T00:00:00.000Z | 14.74 | 74999 | 14
+;
+
+topAscDesc
+required_capability: agg_top
+FROM employees
+| STATS top_asc = TOP(salary, 3, "asc"), top_desc = TOP(salary, 3, "desc")
+;
+
+top_asc:integer | top_desc:integer
+[25324, 25945, 25976] | [74999, 74970, 74572]
+;
+
+topEmpty
+required_capability: agg_top
+FROM employees
+| WHERE salary < 0
+| STATS top = TOP(salary, 3, "asc")
+;
+
+top:integer
+null
+;
+
+topDuplicates
+required_capability: agg_top
+FROM employees
+| STATS integer = TOP(languages, 2, "desc")
+;
+
+integer:integer
+[5, 5]
+;

+ 0 - 156
x-pack/plugin/esql/qa/testFixtures/src/main/resources/stats_top_list.csv-spec

@@ -1,156 +0,0 @@
-topList
-required_capability: agg_top_list
-// tag::top-list[]
-FROM employees
-| STATS top_salaries = TOP_LIST(salary, 3, "desc"), top_salary = MAX(salary)
-// end::top-list[]
-;
-
-// tag::top-list-result[]
-top_salaries:integer | top_salary:integer
-[74999, 74970, 74572] | 74999
-// end::top-list-result[]
-;
-
-topListAllTypesAsc
-required_capability: agg_top_list
-FROM employees
-| STATS
-    date = TOP_LIST(hire_date, 2, "asc"),
-    double = TOP_LIST(salary_change, 2, "asc"),
-    integer = TOP_LIST(salary, 2, "asc"),
-    long = TOP_LIST(salary_change.long, 2, "asc")
-;
-
-date:date | double:double | integer:integer | long:long
-[1985-02-18T00:00:00.000Z,1985-02-24T00:00:00.000Z] | [-9.81,-9.28] | [25324,25945] | [-9,-9]
-;
-
-topListAllTypesDesc
-required_capability: agg_top_list
-FROM employees
-| STATS
-    date = TOP_LIST(hire_date, 2, "desc"),
-    double = TOP_LIST(salary_change, 2, "desc"),
-    integer = TOP_LIST(salary, 2, "desc"),
-    long = TOP_LIST(salary_change.long, 2, "desc")
-;
-
-date:date | double:double | integer:integer | long:long
-[1999-04-30T00:00:00.000Z,1997-05-19T00:00:00.000Z] | [14.74,14.68] | [74999,74970] | [14,14]
-;
-
-topListAllTypesRow
-required_capability: agg_top_list
-ROW
-    constant_date=TO_DATETIME("1985-02-18T00:00:00.000Z"),
-    constant_double=-9.81,
-    constant_integer=25324,
-    constant_long=TO_LONG(-9)
-| STATS
-    date = TOP_LIST(constant_date, 2, "asc"),
-    double = TOP_LIST(constant_double, 2, "asc"),
-    integer = TOP_LIST(constant_integer, 2, "asc"),
-    long = TOP_LIST(constant_long, 2, "asc")
-| keep date, double, integer, long
-;
-
-date:date                | double:double | integer:integer | long:long
-1985-02-18T00:00:00.000Z | -9.81         | 25324           | -9
-;
-
-topListSomeBuckets
-required_capability: agg_top_list
-FROM employees
-| STATS top_salary = TOP_LIST(salary, 2, "desc") by still_hired
-| sort still_hired asc
-;
-
-top_salary:integer | still_hired:boolean
-[74999,74970]      | false
-[74572,73578]      | true
-;
-
-topListManyBuckets
-required_capability: agg_top_list
-FROM employees
-| STATS top_salary = TOP_LIST(salary, 2, "desc") by x=emp_no, y=emp_no+1
-| sort x asc
-| limit 3
-;
-
-top_salary:integer | x:integer | y:integer
-57305              | 10001     | 10002
-56371              | 10002     | 10003
-61805              | 10003     | 10004
-;
-
-topListMultipleStats
-required_capability: agg_top_list
-FROM employees
-| STATS top_salary = TOP_LIST(salary, 1, "desc") by emp_no
-| STATS top_salary = TOP_LIST(top_salary, 3, "asc")
-;
-
-top_salary:integer
-[25324,25945,25976]
-;
-
-topListAllTypesMin
-required_capability: agg_top_list
-FROM employees
-| STATS
-    date = TOP_LIST(hire_date, 1, "asc"),
-    double = TOP_LIST(salary_change, 1, "asc"),
-    integer = TOP_LIST(salary, 1, "asc"),
-    long = TOP_LIST(salary_change.long, 1, "asc")
-;
-
-date:date | double:double | integer:integer | long:long
-1985-02-18T00:00:00.000Z | -9.81 | 25324 | -9
-;
-
-topListAllTypesMax
-required_capability: agg_top_list
-FROM employees
-| STATS
-    date = TOP_LIST(hire_date, 1, "desc"),
-    double = TOP_LIST(salary_change, 1, "desc"),
-    integer = TOP_LIST(salary, 1, "desc"),
-    long = TOP_LIST(salary_change.long, 1, "desc")
-;
-
-date:date | double:double | integer:integer | long:long
-1999-04-30T00:00:00.000Z | 14.74 | 74999 | 14
-;
-
-topListAscDesc
-required_capability: agg_top_list
-FROM employees
-| STATS top_asc = TOP_LIST(salary, 3, "asc"), top_desc = TOP_LIST(salary, 3, "desc")
-;
-
-top_asc:integer | top_desc:integer
-[25324, 25945, 25976] | [74999, 74970, 74572]
-;
-
-topListEmpty
-required_capability: agg_top_list
-FROM employees
-| WHERE salary < 0
-| STATS top = TOP_LIST(salary, 3, "asc")
-;
-
-top:integer
-null
-;
-
-topListDuplicates
-required_capability: agg_top_list
-FROM employees
-| STATS integer = TOP_LIST(languages, 2, "desc")
-;
-
-integer:integer
-[5, 5]
-;

+ 2 - 2
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java

@@ -45,9 +45,9 @@ public class EsqlCapabilities {
         FN_SUBSTRING_EMPTY_NULL,
 
         /**
-         * Support for aggregation function {@code TOP_LIST}.
+         * Support for aggregation function {@code TOP}.
          */
-        AGG_TOP_LIST,
+        AGG_TOP,
 
         /**
          * Optimization for ST_CENTROID changed some results in cartesian data. #108713

+ 2 - 2
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/EsqlFunctionRegistry.java

@@ -24,7 +24,7 @@ import org.elasticsearch.xpack.esql.expression.function.aggregate.Percentile;
 import org.elasticsearch.xpack.esql.expression.function.aggregate.Rate;
 import org.elasticsearch.xpack.esql.expression.function.aggregate.SpatialCentroid;
 import org.elasticsearch.xpack.esql.expression.function.aggregate.Sum;
-import org.elasticsearch.xpack.esql.expression.function.aggregate.TopList;
+import org.elasticsearch.xpack.esql.expression.function.aggregate.Top;
 import org.elasticsearch.xpack.esql.expression.function.aggregate.Values;
 import org.elasticsearch.xpack.esql.expression.function.grouping.Bucket;
 import org.elasticsearch.xpack.esql.expression.function.scalar.conditional.Case;
@@ -198,7 +198,7 @@ public final class EsqlFunctionRegistry extends FunctionRegistry {
                 def(Min.class, Min::new, "min"),
                 def(Percentile.class, Percentile::new, "percentile"),
                 def(Sum.class, Sum::new, "sum"),
-                def(TopList.class, TopList::new, "top_list"),
+                def(Top.class, Top::new, "top"),
                 def(Values.class, Values::new, "values") },
             // math
             new FunctionDefinition[] {

+ 1 - 1
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/AggregateFunction.java

@@ -41,7 +41,7 @@ public abstract class AggregateFunction extends Function {
             Percentile.ENTRY,
             SpatialCentroid.ENTRY,
             Sum.ENTRY,
-            TopList.ENTRY,
+            Top.ENTRY,
             Values.ENTRY,
             Rate.ENTRY,
             // internal functions

+ 15 - 15
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/TopList.java → x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/Top.java

@@ -12,9 +12,9 @@ import org.elasticsearch.common.io.stream.StreamInput;
 import org.elasticsearch.common.io.stream.StreamOutput;
 import org.elasticsearch.common.lucene.BytesRefs;
 import org.elasticsearch.compute.aggregation.AggregatorFunctionSupplier;
-import org.elasticsearch.compute.aggregation.TopListDoubleAggregatorFunctionSupplier;
-import org.elasticsearch.compute.aggregation.TopListIntAggregatorFunctionSupplier;
-import org.elasticsearch.compute.aggregation.TopListLongAggregatorFunctionSupplier;
+import org.elasticsearch.compute.aggregation.TopDoubleAggregatorFunctionSupplier;
+import org.elasticsearch.compute.aggregation.TopIntAggregatorFunctionSupplier;
+import org.elasticsearch.compute.aggregation.TopLongAggregatorFunctionSupplier;
 import org.elasticsearch.xpack.esql.EsqlIllegalArgumentException;
 import org.elasticsearch.xpack.esql.core.expression.Expression;
 import org.elasticsearch.xpack.esql.core.tree.NodeInfo;
@@ -40,8 +40,8 @@ import static org.elasticsearch.xpack.esql.core.expression.TypeResolutions.isNot
 import static org.elasticsearch.xpack.esql.core.expression.TypeResolutions.isString;
 import static org.elasticsearch.xpack.esql.core.expression.TypeResolutions.isType;
 
-public class TopList extends AggregateFunction implements ToAggregator, SurrogateExpression {
-    public static final NamedWriteableRegistry.Entry ENTRY = new NamedWriteableRegistry.Entry(Expression.class, "TopList", TopList::new);
+public class Top extends AggregateFunction implements ToAggregator, SurrogateExpression {
+    public static final NamedWriteableRegistry.Entry ENTRY = new NamedWriteableRegistry.Entry(Expression.class, "Top", Top::new);
 
     private static final String ORDER_ASC = "ASC";
     private static final String ORDER_DESC = "DESC";
@@ -50,9 +50,9 @@ public class TopList extends AggregateFunction implements ToAggregator, Surrogat
         returnType = { "double", "integer", "long", "date" },
         description = "Collects the top values for a field. Includes repeated values.",
         isAggregation = true,
-        examples = @Example(file = "stats_top_list", tag = "top-list")
+        examples = @Example(file = "stats_top", tag = "top")
     )
-    public TopList(
+    public Top(
         Source source,
         @Param(
             name = "field",
@@ -69,7 +69,7 @@ public class TopList extends AggregateFunction implements ToAggregator, Surrogat
         super(source, field, Arrays.asList(limit, order));
     }
 
-    private TopList(StreamInput in) throws IOException {
+    private Top(StreamInput in) throws IOException {
         this(
             Source.readFrom((PlanStreamInput) in),
             ((PlanStreamInput) in).readExpression(),
@@ -156,26 +156,26 @@ public class TopList extends AggregateFunction implements ToAggregator, Surrogat
     }
 
     @Override
-    protected NodeInfo<TopList> info() {
-        return NodeInfo.create(this, TopList::new, children().get(0), children().get(1), children().get(2));
+    protected NodeInfo<Top> info() {
+        return NodeInfo.create(this, Top::new, children().get(0), children().get(1), children().get(2));
     }
 
     @Override
-    public TopList replaceChildren(List<Expression> newChildren) {
-        return new TopList(source(), newChildren.get(0), newChildren.get(1), newChildren.get(2));
+    public Top replaceChildren(List<Expression> newChildren) {
+        return new Top(source(), newChildren.get(0), newChildren.get(1), newChildren.get(2));
     }
 
     @Override
     public AggregatorFunctionSupplier supplier(List<Integer> inputChannels) {
         DataType type = field().dataType();
         if (type == DataType.LONG || type == DataType.DATETIME) {
-            return new TopListLongAggregatorFunctionSupplier(inputChannels, limitValue(), orderValue());
+            return new TopLongAggregatorFunctionSupplier(inputChannels, limitValue(), orderValue());
         }
         if (type == DataType.INTEGER) {
-            return new TopListIntAggregatorFunctionSupplier(inputChannels, limitValue(), orderValue());
+            return new TopIntAggregatorFunctionSupplier(inputChannels, limitValue(), orderValue());
         }
         if (type == DataType.DOUBLE) {
-            return new TopListDoubleAggregatorFunctionSupplier(inputChannels, limitValue(), orderValue());
+            return new TopDoubleAggregatorFunctionSupplier(inputChannels, limitValue(), orderValue());
         }
         throw EsqlIllegalArgumentException.illegalDataType(type);
     }

+ 2 - 2
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/package-info.java

@@ -94,7 +94,7 @@
  *                 to keep all the logic in one place.
  *                 <p>
  *                     You can find examples of other aggregations using this method,
- *                     like {@link org.elasticsearch.xpack.esql.expression.function.aggregate.TopList#writeTo(PlanStreamOutput)}
+ *                     like {@link org.elasticsearch.xpack.esql.expression.function.aggregate.Top#writeTo(PlanStreamOutput)}
  *                 </p>
  *             </li>
  *             <li>
@@ -155,7 +155,7 @@
  *     <li>
  *         Create a new StringTemplate file.
  *         Use another as a reference, like
- *         {@code x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/X-TopListAggregator.java.st}.
+ *         {@code x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/X-TopAggregator.java.st}.
  *     </li>
  *     <li>
  *         Add the template scripts to {@code x-pack/plugin/esql/compute/build.gradle}.

+ 3 - 3
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/planner/AggregateMapper.java

@@ -36,7 +36,7 @@ import org.elasticsearch.xpack.esql.expression.function.aggregate.SpatialAggrega
 import org.elasticsearch.xpack.esql.expression.function.aggregate.SpatialCentroid;
 import org.elasticsearch.xpack.esql.expression.function.aggregate.Sum;
 import org.elasticsearch.xpack.esql.expression.function.aggregate.ToPartial;
-import org.elasticsearch.xpack.esql.expression.function.aggregate.TopList;
+import org.elasticsearch.xpack.esql.expression.function.aggregate.Top;
 import org.elasticsearch.xpack.esql.expression.function.aggregate.Values;
 
 import java.lang.invoke.MethodHandle;
@@ -67,7 +67,7 @@ final class AggregateMapper {
         SpatialCentroid.class,
         Sum.class,
         Values.class,
-        TopList.class,
+        Top.class,
         Rate.class,
 
         // internal function
@@ -154,7 +154,7 @@ final class AggregateMapper {
         } else if (Values.class.isAssignableFrom(clazz)) {
             // TODO can't we figure this out from the function itself?
             types = List.of("Int", "Long", "Double", "Boolean", "BytesRef");
-        } else if (TopList.class.isAssignableFrom(clazz)) {
+        } else if (Top.class.isAssignableFrom(clazz)) {
             types = List.of("Int", "Long", "Double");
         } else if (Rate.class.isAssignableFrom(clazz)) {
             types = List.of("Int", "Long", "Double");

+ 5 - 5
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/aggregate/TopListSerializationTests.java → x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/aggregate/TopSerializationTests.java

@@ -15,18 +15,18 @@ import org.elasticsearch.xpack.esql.expression.AbstractExpressionSerializationTe
 import java.io.IOException;
 import java.util.List;
 
-public class TopListSerializationTests extends AbstractExpressionSerializationTests<TopList> {
+public class TopSerializationTests extends AbstractExpressionSerializationTests<Top> {
     @Override
-    protected TopList createTestInstance() {
+    protected Top createTestInstance() {
         Source source = randomSource();
         Expression field = randomChild();
         Expression limit = randomChild();
         Expression order = randomChild();
-        return new TopList(source, field, limit, order);
+        return new Top(source, field, limit, order);
     }
 
     @Override
-    protected TopList mutateInstance(TopList instance) throws IOException {
+    protected Top mutateInstance(Top instance) throws IOException {
         Source source = instance.source();
         Expression field = instance.field();
         Expression limit = instance.limitField();
@@ -36,7 +36,7 @@ public class TopListSerializationTests extends AbstractExpressionSerializationTe
             case 1 -> limit = randomValueOtherThan(limit, AbstractExpressionSerializationTests::randomChild);
             case 2 -> order = randomValueOtherThan(order, AbstractExpressionSerializationTests::randomChild);
         }
-        return new TopList(source, field, limit, order);
+        return new Top(source, field, limit, order);
     }
 
     @Override

+ 15 - 15
x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/aggregate/TopListTests.java → x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/aggregate/TopTests.java

@@ -22,8 +22,8 @@ import java.util.function.Supplier;
 
 import static org.hamcrest.Matchers.equalTo;
 
-public class TopListTests extends AbstractAggregationTestCase {
-    public TopListTests(@Name("TestCase") Supplier<TestCaseSupplier.TestCase> testCaseSupplier) {
+public class TopTests extends AbstractAggregationTestCase {
+    public TopTests(@Name("TestCase") Supplier<TestCaseSupplier.TestCase> testCaseSupplier) {
         this.testCase = testCaseSupplier.get();
     }
 
@@ -39,7 +39,7 @@ public class TopListTests extends AbstractAggregationTestCase {
                         new TestCaseSupplier.TypedData(limit, DataType.INTEGER, "limit").forceLiteral(),
                         new TestCaseSupplier.TypedData(new BytesRef("desc"), DataType.KEYWORD, "order").forceLiteral()
                     ),
-                    "TopList[field=Attribute[channel=0], limit=Attribute[channel=1], order=Attribute[channel=2]]",
+                    "Top[field=Attribute[channel=0], limit=Attribute[channel=1], order=Attribute[channel=2]]",
                     DataType.INTEGER,
                     equalTo(List.of(200, 8, 5, 0).subList(0, limit))
                 );
@@ -52,7 +52,7 @@ public class TopListTests extends AbstractAggregationTestCase {
                         new TestCaseSupplier.TypedData(limit, DataType.INTEGER, "limit").forceLiteral(),
                         new TestCaseSupplier.TypedData(new BytesRef("desc"), DataType.KEYWORD, "order").forceLiteral()
                     ),
-                    "TopList[field=Attribute[channel=0], limit=Attribute[channel=1], order=Attribute[channel=2]]",
+                    "Top[field=Attribute[channel=0], limit=Attribute[channel=1], order=Attribute[channel=2]]",
                     DataType.LONG,
                     equalTo(List.of(200L, 8L, 5L, 0L).subList(0, limit))
                 );
@@ -65,7 +65,7 @@ public class TopListTests extends AbstractAggregationTestCase {
                         new TestCaseSupplier.TypedData(limit, DataType.INTEGER, "limit").forceLiteral(),
                         new TestCaseSupplier.TypedData(new BytesRef("desc"), DataType.KEYWORD, "order").forceLiteral()
                     ),
-                    "TopList[field=Attribute[channel=0], limit=Attribute[channel=1], order=Attribute[channel=2]]",
+                    "Top[field=Attribute[channel=0], limit=Attribute[channel=1], order=Attribute[channel=2]]",
                     DataType.DOUBLE,
                     equalTo(List.of(200., 8., 5., 0.).subList(0, limit))
                 );
@@ -78,7 +78,7 @@ public class TopListTests extends AbstractAggregationTestCase {
                         new TestCaseSupplier.TypedData(limit, DataType.INTEGER, "limit").forceLiteral(),
                         new TestCaseSupplier.TypedData(new BytesRef("desc"), DataType.KEYWORD, "order").forceLiteral()
                     ),
-                    "TopList[field=Attribute[channel=0], limit=Attribute[channel=1], order=Attribute[channel=2]]",
+                    "Top[field=Attribute[channel=0], limit=Attribute[channel=1], order=Attribute[channel=2]]",
                     DataType.DATETIME,
                     equalTo(List.of(200L, 8L, 5L, 0L).subList(0, limit))
                 );
@@ -93,7 +93,7 @@ public class TopListTests extends AbstractAggregationTestCase {
                         new TestCaseSupplier.TypedData(1, DataType.INTEGER, "limit").forceLiteral(),
                         new TestCaseSupplier.TypedData(new BytesRef("desc"), DataType.KEYWORD, "order").forceLiteral()
                     ),
-                    "TopList[field=Attribute[channel=0], limit=Attribute[channel=1], order=Attribute[channel=2]]",
+                    "Top[field=Attribute[channel=0], limit=Attribute[channel=1], order=Attribute[channel=2]]",
                     DataType.INTEGER,
                     equalTo(200)
                 )
@@ -106,7 +106,7 @@ public class TopListTests extends AbstractAggregationTestCase {
                         new TestCaseSupplier.TypedData(1, DataType.INTEGER, "limit").forceLiteral(),
                         new TestCaseSupplier.TypedData(new BytesRef("desc"), DataType.KEYWORD, "order").forceLiteral()
                     ),
-                    "TopList[field=Attribute[channel=0], limit=Attribute[channel=1], order=Attribute[channel=2]]",
+                    "Top[field=Attribute[channel=0], limit=Attribute[channel=1], order=Attribute[channel=2]]",
                     DataType.LONG,
                     equalTo(200L)
                 )
@@ -119,7 +119,7 @@ public class TopListTests extends AbstractAggregationTestCase {
                         new TestCaseSupplier.TypedData(1, DataType.INTEGER, "limit").forceLiteral(),
                         new TestCaseSupplier.TypedData(new BytesRef("desc"), DataType.KEYWORD, "order").forceLiteral()
                     ),
-                    "TopList[field=Attribute[channel=0], limit=Attribute[channel=1], order=Attribute[channel=2]]",
+                    "Top[field=Attribute[channel=0], limit=Attribute[channel=1], order=Attribute[channel=2]]",
                     DataType.DOUBLE,
                     equalTo(200.)
                 )
@@ -132,7 +132,7 @@ public class TopListTests extends AbstractAggregationTestCase {
                         new TestCaseSupplier.TypedData(1, DataType.INTEGER, "limit").forceLiteral(),
                         new TestCaseSupplier.TypedData(new BytesRef("desc"), DataType.KEYWORD, "order").forceLiteral()
                     ),
-                    "TopList[field=Attribute[channel=0], limit=Attribute[channel=1], order=Attribute[channel=2]]",
+                    "Top[field=Attribute[channel=0], limit=Attribute[channel=1], order=Attribute[channel=2]]",
                     DataType.DATETIME,
                     equalTo(200L)
                 )
@@ -147,7 +147,7 @@ public class TopListTests extends AbstractAggregationTestCase {
                         new TestCaseSupplier.TypedData(1, DataType.INTEGER, "limit").forceLiteral(),
                         new TestCaseSupplier.TypedData(new BytesRef("desc"), DataType.KEYWORD, "order").forceLiteral()
                     ),
-                    "TopList[field=Attribute[channel=0], limit=Attribute[channel=1], order=Attribute[channel=2]]",
+                    "Top[field=Attribute[channel=0], limit=Attribute[channel=1], order=Attribute[channel=2]]",
                     DataType.INTEGER,
                     equalTo(200)
                 )
@@ -160,7 +160,7 @@ public class TopListTests extends AbstractAggregationTestCase {
                         new TestCaseSupplier.TypedData(1, DataType.INTEGER, "limit").forceLiteral(),
                         new TestCaseSupplier.TypedData(new BytesRef("desc"), DataType.KEYWORD, "order").forceLiteral()
                     ),
-                    "TopList[field=Attribute[channel=0], limit=Attribute[channel=1], order=Attribute[channel=2]]",
+                    "Top[field=Attribute[channel=0], limit=Attribute[channel=1], order=Attribute[channel=2]]",
                     DataType.LONG,
                     equalTo(200L)
                 )
@@ -173,7 +173,7 @@ public class TopListTests extends AbstractAggregationTestCase {
                         new TestCaseSupplier.TypedData(1, DataType.INTEGER, "limit").forceLiteral(),
                         new TestCaseSupplier.TypedData(new BytesRef("desc"), DataType.KEYWORD, "order").forceLiteral()
                     ),
-                    "TopList[field=Attribute[channel=0], limit=Attribute[channel=1], order=Attribute[channel=2]]",
+                    "Top[field=Attribute[channel=0], limit=Attribute[channel=1], order=Attribute[channel=2]]",
                     DataType.DOUBLE,
                     equalTo(200.)
                 )
@@ -186,7 +186,7 @@ public class TopListTests extends AbstractAggregationTestCase {
                         new TestCaseSupplier.TypedData(1, DataType.INTEGER, "limit").forceLiteral(),
                         new TestCaseSupplier.TypedData(new BytesRef("desc"), DataType.KEYWORD, "order").forceLiteral()
                     ),
-                    "TopList[field=Attribute[channel=0], limit=Attribute[channel=1], order=Attribute[channel=2]]",
+                    "Top[field=Attribute[channel=0], limit=Attribute[channel=1], order=Attribute[channel=2]]",
                     DataType.DATETIME,
                     equalTo(200L)
                 )
@@ -244,6 +244,6 @@ public class TopListTests extends AbstractAggregationTestCase {
 
     @Override
     protected Expression build(Source source, List<Expression> args) {
-        return new TopList(source, args.get(0), args.get(1), args.get(2));
+        return new Top(source, args.get(0), args.get(1), args.get(2));
     }
 }