From 7ec905caccffa31a5bd6eed12320e20baa5fe41f Mon Sep 17 00:00:00 2001
From: "ievgen.degtiarenko"
Date: Tue, 4 Feb 2025 09:08:22 +0100
Subject: [PATCH] Remove `combineValueCount` from code generation
`combineValueCount` is described as something that might no longer be needed and has zero actual usages. Removing it in order to simplify code generation.
---
.../java/org/elasticsearch/compute/ann/Aggregator.java | 5 -----
.../elasticsearch/compute/gen/AggregatorImplementer.java | 8 --------
2 files changed, 13 deletions(-)
diff --git a/x-pack/plugin/esql/compute/ann/src/main/java/org/elasticsearch/compute/ann/Aggregator.java b/x-pack/plugin/esql/compute/ann/src/main/java/org/elasticsearch/compute/ann/Aggregator.java
index 444dbcc1b9e58..794baf1759204 100644
--- a/x-pack/plugin/esql/compute/ann/src/main/java/org/elasticsearch/compute/ann/Aggregator.java
+++ b/x-pack/plugin/esql/compute/ann/src/main/java/org/elasticsearch/compute/ann/Aggregator.java
@@ -37,11 +37,6 @@
* are ever collected.
*
*
- * The generation code will also look for a method called {@code combineValueCount}
- * which is called once per received block with a count of values. NOTE: We may
- * not need this after we convert AVG into a composite operation.
- *
- *
* The generation code also looks for the optional methods {@code combineIntermediate}
* and {@code evaluateFinal} which are used to combine intermediate states and
* produce the final output. If the first is missing then the generated code will
diff --git a/x-pack/plugin/esql/compute/gen/src/main/java/org/elasticsearch/compute/gen/AggregatorImplementer.java b/x-pack/plugin/esql/compute/gen/src/main/java/org/elasticsearch/compute/gen/AggregatorImplementer.java
index 46881bf337c89..c62dc9ed24d8a 100644
--- a/x-pack/plugin/esql/compute/gen/src/main/java/org/elasticsearch/compute/gen/AggregatorImplementer.java
+++ b/x-pack/plugin/esql/compute/gen/src/main/java/org/elasticsearch/compute/gen/AggregatorImplementer.java
@@ -78,7 +78,6 @@ public class AggregatorImplementer {
private final List warnExceptions;
private final ExecutableElement init;
private final ExecutableElement combine;
- private final ExecutableElement combineValueCount;
private final ExecutableElement combineIntermediate;
private final ExecutableElement evaluateFinal;
private final ClassName implementation;
@@ -115,7 +114,6 @@ public AggregatorImplementer(
TypeName firstParamType = TypeName.get(e.getParameters().get(0).asType());
return firstParamType.isPrimitive() || firstParamType.toString().equals(stateType.toString());
});
- this.combineValueCount = findMethod(declarationType, "combineValueCount");
this.combineIntermediate = findMethod(declarationType, "combineIntermediate");
this.evaluateFinal = findMethod(declarationType, "evaluateFinal");
this.createParameters = init.getParameters()
@@ -415,9 +413,6 @@ private MethodSpec addRawVector(boolean masked) {
combineRawInput(builder, "vector");
}
builder.endControlFlow();
- if (combineValueCount != null) {
- builder.addStatement("$T.combineValueCount(state, vector.getPositionCount())", declarationType);
- }
return builder.build();
}
@@ -459,9 +454,6 @@ private MethodSpec addRawBlock(boolean masked) {
}
}
builder.endControlFlow();
- if (combineValueCount != null) {
- builder.addStatement("$T.combineValueCount(state, block.getTotalValueCount())", declarationType);
- }
return builder.build();
}