diff --git a/x-pack/plugin/esql/compute/gen/src/main/java/org/elasticsearch/compute/gen/GroupingAggregatorImplementer.java b/x-pack/plugin/esql/compute/gen/src/main/java/org/elasticsearch/compute/gen/GroupingAggregatorImplementer.java
index 3dffbcf84eb78..23240bbd50ea6 100644
--- a/x-pack/plugin/esql/compute/gen/src/main/java/org/elasticsearch/compute/gen/GroupingAggregatorImplementer.java
+++ b/x-pack/plugin/esql/compute/gen/src/main/java/org/elasticsearch/compute/gen/GroupingAggregatorImplementer.java
@@ -182,6 +182,7 @@ private TypeSpec type() {
builder.addMethod(addRawInputLoop(INT_VECTOR, valueVectorType(init, combine)));
builder.addMethod(addRawInputLoop(INT_BLOCK, valueBlockType(init, combine)));
builder.addMethod(addRawInputLoop(INT_BLOCK, valueVectorType(init, combine)));
+ builder.addMethod(selectedMayContainUnseenGroups());
builder.addMethod(addIntermediateInput());
builder.addMethod(addIntermediateRowInput());
builder.addMethod(evaluateIntermediate());
@@ -338,6 +339,9 @@ private TypeSpec addInput(Consumer addBlock) {
addBlock.accept(vector);
builder.addMethod(vector.build());
+ MethodSpec.Builder close = MethodSpec.methodBuilder("close").addAnnotation(Override.class).addModifiers(Modifier.PUBLIC);
+ builder.addMethod(close.build());
+
return builder.build();
}
@@ -485,6 +489,14 @@ private void combineRawInputForBytesRef(MethodSpec.Builder builder, String block
builder.addStatement("$T.combine(state, groupId, $L.getBytesRef($L, scratch))", declarationType, blockVariable, offsetVariable);
}
+ private MethodSpec selectedMayContainUnseenGroups() {
+ MethodSpec.Builder builder = MethodSpec.methodBuilder("selectedMayContainUnseenGroups");
+ builder.addAnnotation(Override.class).addModifiers(Modifier.PUBLIC);
+ builder.addParameter(SEEN_GROUP_IDS, "seenGroupIds");
+ builder.addStatement("state.enableGroupIdTracking(seenGroupIds)");
+ return builder.build();
+ }
+
private MethodSpec addIntermediateInput() {
MethodSpec.Builder builder = MethodSpec.methodBuilder("addIntermediateInput");
builder.addAnnotation(Override.class).addModifiers(Modifier.PUBLIC);
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/CountDistinctBooleanGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/CountDistinctBooleanGroupingAggregatorFunction.java
index 98e57b71db416..4cdecd9944f7b 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/CountDistinctBooleanGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/CountDistinctBooleanGroupingAggregatorFunction.java
@@ -73,6 +73,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -85,6 +89,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -144,6 +152,11 @@ private void addRawInput(int positionOffset, IntBlock groups, BooleanVector valu
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/CountDistinctBytesRefGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/CountDistinctBytesRefGroupingAggregatorFunction.java
index 35fd83598b9d6..2261a60ff247e 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/CountDistinctBytesRefGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/CountDistinctBytesRefGroupingAggregatorFunction.java
@@ -76,6 +76,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -88,6 +92,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -151,6 +159,11 @@ private void addRawInput(int positionOffset, IntBlock groups, BytesRefVector val
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/CountDistinctDoubleGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/CountDistinctDoubleGroupingAggregatorFunction.java
index 894b81b311363..c769a157e5ecb 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/CountDistinctDoubleGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/CountDistinctDoubleGroupingAggregatorFunction.java
@@ -78,6 +78,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -90,6 +94,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -149,6 +157,11 @@ private void addRawInput(int positionOffset, IntBlock groups, DoubleVector value
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/CountDistinctFloatGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/CountDistinctFloatGroupingAggregatorFunction.java
index 5f6b4211e6c5e..0b1c93aad5e2b 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/CountDistinctFloatGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/CountDistinctFloatGroupingAggregatorFunction.java
@@ -78,6 +78,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -90,6 +94,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -149,6 +157,11 @@ private void addRawInput(int positionOffset, IntBlock groups, FloatVector values
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/CountDistinctIntGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/CountDistinctIntGroupingAggregatorFunction.java
index 83300393e560d..7642ca7dcc6a0 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/CountDistinctIntGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/CountDistinctIntGroupingAggregatorFunction.java
@@ -76,6 +76,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -88,6 +92,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -147,6 +155,11 @@ private void addRawInput(int positionOffset, IntBlock groups, IntVector values)
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/CountDistinctLongGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/CountDistinctLongGroupingAggregatorFunction.java
index 44e9fefb3161c..00d0e955ba88a 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/CountDistinctLongGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/CountDistinctLongGroupingAggregatorFunction.java
@@ -78,6 +78,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -90,6 +94,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -149,6 +157,11 @@ private void addRawInput(int positionOffset, IntBlock groups, LongVector values)
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MaxBooleanGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MaxBooleanGroupingAggregatorFunction.java
index 084e346a7b093..dd7760273bfa6 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MaxBooleanGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MaxBooleanGroupingAggregatorFunction.java
@@ -73,6 +73,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -85,6 +89,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -144,6 +152,11 @@ private void addRawInput(int positionOffset, IntBlock groups, BooleanVector valu
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MaxBytesRefGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MaxBytesRefGroupingAggregatorFunction.java
index a50cf8593a6e1..fcb87428e9b7d 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MaxBytesRefGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MaxBytesRefGroupingAggregatorFunction.java
@@ -76,6 +76,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -88,6 +92,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -151,6 +159,11 @@ private void addRawInput(int positionOffset, IntBlock groups, BytesRefVector val
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MaxDoubleGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MaxDoubleGroupingAggregatorFunction.java
index b874bc43dc238..42588ea81367c 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MaxDoubleGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MaxDoubleGroupingAggregatorFunction.java
@@ -75,6 +75,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -87,6 +91,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -146,6 +154,11 @@ private void addRawInput(int positionOffset, IntBlock groups, DoubleVector value
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MaxFloatGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MaxFloatGroupingAggregatorFunction.java
index f3ebd468ebc72..006ee147b15e1 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MaxFloatGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MaxFloatGroupingAggregatorFunction.java
@@ -75,6 +75,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -87,6 +91,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -146,6 +154,11 @@ private void addRawInput(int positionOffset, IntBlock groups, FloatVector values
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MaxIntGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MaxIntGroupingAggregatorFunction.java
index 8b364e7a02e96..faea5a63eac93 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MaxIntGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MaxIntGroupingAggregatorFunction.java
@@ -73,6 +73,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -85,6 +89,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -144,6 +152,11 @@ private void addRawInput(int positionOffset, IntBlock groups, IntVector values)
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MaxIpGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MaxIpGroupingAggregatorFunction.java
index a722d95f3b108..f5715949094f7 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MaxIpGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MaxIpGroupingAggregatorFunction.java
@@ -76,6 +76,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -88,6 +92,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -151,6 +159,11 @@ private void addRawInput(int positionOffset, IntBlock groups, BytesRefVector val
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MaxLongGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MaxLongGroupingAggregatorFunction.java
index fee2f5a9c2e7c..a5f115ad0d2b1 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MaxLongGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MaxLongGroupingAggregatorFunction.java
@@ -75,6 +75,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -87,6 +91,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -146,6 +154,11 @@ private void addRawInput(int positionOffset, IntBlock groups, LongVector values)
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MedianAbsoluteDeviationDoubleGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MedianAbsoluteDeviationDoubleGroupingAggregatorFunction.java
index 836248428f231..4a6fc2bfce4f9 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MedianAbsoluteDeviationDoubleGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MedianAbsoluteDeviationDoubleGroupingAggregatorFunction.java
@@ -75,6 +75,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -87,6 +91,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -146,6 +154,11 @@ private void addRawInput(int positionOffset, IntBlock groups, DoubleVector value
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MedianAbsoluteDeviationFloatGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MedianAbsoluteDeviationFloatGroupingAggregatorFunction.java
index 7a67f0d3449f0..35f18ef0df552 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MedianAbsoluteDeviationFloatGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MedianAbsoluteDeviationFloatGroupingAggregatorFunction.java
@@ -75,6 +75,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -87,6 +91,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -146,6 +154,11 @@ private void addRawInput(int positionOffset, IntBlock groups, FloatVector values
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MedianAbsoluteDeviationIntGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MedianAbsoluteDeviationIntGroupingAggregatorFunction.java
index 315034a28ff8f..9819f4472c1a5 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MedianAbsoluteDeviationIntGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MedianAbsoluteDeviationIntGroupingAggregatorFunction.java
@@ -73,6 +73,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -85,6 +89,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -144,6 +152,11 @@ private void addRawInput(int positionOffset, IntBlock groups, IntVector values)
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MedianAbsoluteDeviationLongGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MedianAbsoluteDeviationLongGroupingAggregatorFunction.java
index af0374012be52..70da9fb19568f 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MedianAbsoluteDeviationLongGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MedianAbsoluteDeviationLongGroupingAggregatorFunction.java
@@ -75,6 +75,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -87,6 +91,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -146,6 +154,11 @@ private void addRawInput(int positionOffset, IntBlock groups, LongVector values)
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MinBooleanGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MinBooleanGroupingAggregatorFunction.java
index 45e677ee25b56..71e636001cd5f 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MinBooleanGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MinBooleanGroupingAggregatorFunction.java
@@ -73,6 +73,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -85,6 +89,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -144,6 +152,11 @@ private void addRawInput(int positionOffset, IntBlock groups, BooleanVector valu
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MinBytesRefGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MinBytesRefGroupingAggregatorFunction.java
index e092dd93210f6..1650c6c513fdd 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MinBytesRefGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MinBytesRefGroupingAggregatorFunction.java
@@ -76,6 +76,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -88,6 +92,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -151,6 +159,11 @@ private void addRawInput(int positionOffset, IntBlock groups, BytesRefVector val
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MinDoubleGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MinDoubleGroupingAggregatorFunction.java
index 970a8a7597514..729c77a225049 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MinDoubleGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MinDoubleGroupingAggregatorFunction.java
@@ -75,6 +75,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -87,6 +91,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -146,6 +154,11 @@ private void addRawInput(int positionOffset, IntBlock groups, DoubleVector value
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MinFloatGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MinFloatGroupingAggregatorFunction.java
index 4e8b4cc9417c8..d3d59935e62d5 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MinFloatGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MinFloatGroupingAggregatorFunction.java
@@ -75,6 +75,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -87,6 +91,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -146,6 +154,11 @@ private void addRawInput(int positionOffset, IntBlock groups, FloatVector values
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MinIntGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MinIntGroupingAggregatorFunction.java
index 6e976a582a892..7095608ca50cc 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MinIntGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MinIntGroupingAggregatorFunction.java
@@ -73,6 +73,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -85,6 +89,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -144,6 +152,11 @@ private void addRawInput(int positionOffset, IntBlock groups, IntVector values)
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MinIpGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MinIpGroupingAggregatorFunction.java
index 146515d363af7..0cb4154009a90 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MinIpGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MinIpGroupingAggregatorFunction.java
@@ -76,6 +76,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -88,6 +92,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -151,6 +159,11 @@ private void addRawInput(int positionOffset, IntBlock groups, BytesRefVector val
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MinLongGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MinLongGroupingAggregatorFunction.java
index a3db9a2704660..0498c4b8d866b 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MinLongGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/MinLongGroupingAggregatorFunction.java
@@ -75,6 +75,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -87,6 +91,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -146,6 +154,11 @@ private void addRawInput(int positionOffset, IntBlock groups, LongVector values)
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/PercentileDoubleGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/PercentileDoubleGroupingAggregatorFunction.java
index 871e93a72d900..c10d25c059682 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/PercentileDoubleGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/PercentileDoubleGroupingAggregatorFunction.java
@@ -78,6 +78,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -90,6 +94,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -149,6 +157,11 @@ private void addRawInput(int positionOffset, IntBlock groups, DoubleVector value
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/PercentileFloatGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/PercentileFloatGroupingAggregatorFunction.java
index 8b0f28b2632d1..982b07da1bd8d 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/PercentileFloatGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/PercentileFloatGroupingAggregatorFunction.java
@@ -78,6 +78,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -90,6 +94,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -149,6 +157,11 @@ private void addRawInput(int positionOffset, IntBlock groups, FloatVector values
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/PercentileIntGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/PercentileIntGroupingAggregatorFunction.java
index fc1031dcbe0d0..ed50eb683ba97 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/PercentileIntGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/PercentileIntGroupingAggregatorFunction.java
@@ -76,6 +76,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -88,6 +92,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -147,6 +155,11 @@ private void addRawInput(int positionOffset, IntBlock groups, IntVector values)
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/PercentileLongGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/PercentileLongGroupingAggregatorFunction.java
index 1b14f02356b8f..12f64133d10f2 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/PercentileLongGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/PercentileLongGroupingAggregatorFunction.java
@@ -78,6 +78,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -90,6 +94,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -149,6 +157,11 @@ private void addRawInput(int positionOffset, IntBlock groups, LongVector values)
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/RateDoubleGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/RateDoubleGroupingAggregatorFunction.java
index c85cf78a39c45..2fca5c1d19c5e 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/RateDoubleGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/RateDoubleGroupingAggregatorFunction.java
@@ -85,6 +85,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock, timestampsVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -97,6 +101,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector, timestampsVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -162,6 +170,11 @@ private void addRawInput(int positionOffset, IntBlock groups, DoubleVector value
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/RateFloatGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/RateFloatGroupingAggregatorFunction.java
index a5d2131a2445a..628503f12900e 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/RateFloatGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/RateFloatGroupingAggregatorFunction.java
@@ -87,6 +87,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock, timestampsVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -99,6 +103,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector, timestampsVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -164,6 +172,11 @@ private void addRawInput(int positionOffset, IntBlock groups, FloatVector values
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/RateIntGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/RateIntGroupingAggregatorFunction.java
index 0fb0b05c11164..2f030544da612 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/RateIntGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/RateIntGroupingAggregatorFunction.java
@@ -85,6 +85,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock, timestampsVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -97,6 +101,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector, timestampsVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -162,6 +170,11 @@ private void addRawInput(int positionOffset, IntBlock groups, IntVector values,
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/RateLongGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/RateLongGroupingAggregatorFunction.java
index 82297b618b03e..fd272e47fa6a3 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/RateLongGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/RateLongGroupingAggregatorFunction.java
@@ -85,6 +85,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock, timestampsVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -97,6 +101,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector, timestampsVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -162,6 +170,11 @@ private void addRawInput(int positionOffset, IntBlock groups, LongVector values,
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/SumDoubleGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/SumDoubleGroupingAggregatorFunction.java
index 4f0bcae66ee4a..71b282c58aca2 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/SumDoubleGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/SumDoubleGroupingAggregatorFunction.java
@@ -76,6 +76,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -88,6 +92,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -147,6 +155,11 @@ private void addRawInput(int positionOffset, IntBlock groups, DoubleVector value
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/SumFloatGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/SumFloatGroupingAggregatorFunction.java
index 2f4165dfeadfa..664f616acee9d 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/SumFloatGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/SumFloatGroupingAggregatorFunction.java
@@ -78,6 +78,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -90,6 +94,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -149,6 +157,11 @@ private void addRawInput(int positionOffset, IntBlock groups, FloatVector values
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/SumIntGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/SumIntGroupingAggregatorFunction.java
index 95d380c455bf4..2f369374d8cdb 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/SumIntGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/SumIntGroupingAggregatorFunction.java
@@ -75,6 +75,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -87,6 +91,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -146,6 +154,11 @@ private void addRawInput(int positionOffset, IntBlock groups, IntVector values)
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/SumLongGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/SumLongGroupingAggregatorFunction.java
index 324d8f53e65cb..c8c0990de4e54 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/SumLongGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/SumLongGroupingAggregatorFunction.java
@@ -75,6 +75,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -87,6 +91,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -146,6 +154,11 @@ private void addRawInput(int positionOffset, IntBlock groups, LongVector values)
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopBooleanGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopBooleanGroupingAggregatorFunction.java
index d169c456329b7..cd35595eeadb0 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopBooleanGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopBooleanGroupingAggregatorFunction.java
@@ -79,6 +79,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -91,6 +95,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -150,6 +158,11 @@ private void addRawInput(int positionOffset, IntBlock groups, BooleanVector valu
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopDoubleGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopDoubleGroupingAggregatorFunction.java
index 07da387f88ce6..6b76ff7772ad1 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopDoubleGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopDoubleGroupingAggregatorFunction.java
@@ -79,6 +79,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -91,6 +95,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -150,6 +158,11 @@ private void addRawInput(int positionOffset, IntBlock groups, DoubleVector value
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopFloatGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopFloatGroupingAggregatorFunction.java
index 369fa7401e508..ffaf858645440 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopFloatGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopFloatGroupingAggregatorFunction.java
@@ -79,6 +79,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -91,6 +95,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -150,6 +158,11 @@ private void addRawInput(int positionOffset, IntBlock groups, FloatVector values
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopIntGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopIntGroupingAggregatorFunction.java
index 04b53fe6aab69..a3453126e055e 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopIntGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopIntGroupingAggregatorFunction.java
@@ -77,6 +77,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -89,6 +93,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -148,6 +156,11 @@ private void addRawInput(int positionOffset, IntBlock groups, IntVector values)
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopIpGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopIpGroupingAggregatorFunction.java
index 272b4827b5817..74a6987962b78 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopIpGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopIpGroupingAggregatorFunction.java
@@ -80,6 +80,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -92,6 +96,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -155,6 +163,11 @@ private void addRawInput(int positionOffset, IntBlock groups, BytesRefVector val
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopLongGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopLongGroupingAggregatorFunction.java
index 9d1ed395c5964..b4a4b7154e626 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopLongGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/TopLongGroupingAggregatorFunction.java
@@ -79,6 +79,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -91,6 +95,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -150,6 +158,11 @@ private void addRawInput(int positionOffset, IntBlock groups, LongVector values)
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/ValuesBooleanGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/ValuesBooleanGroupingAggregatorFunction.java
index 062a49dbf4f7c..b51da118e0f8d 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/ValuesBooleanGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/ValuesBooleanGroupingAggregatorFunction.java
@@ -72,6 +72,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -84,6 +88,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -143,6 +151,11 @@ private void addRawInput(int positionOffset, IntBlock groups, BooleanVector valu
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/ValuesBytesRefGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/ValuesBytesRefGroupingAggregatorFunction.java
index 0a929913e9fde..bdce606f92168 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/ValuesBytesRefGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/ValuesBytesRefGroupingAggregatorFunction.java
@@ -73,6 +73,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -85,6 +89,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -148,6 +156,11 @@ private void addRawInput(int positionOffset, IntBlock groups, BytesRefVector val
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/ValuesDoubleGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/ValuesDoubleGroupingAggregatorFunction.java
index b8ca2d2b9665b..5b8c2ac802663 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/ValuesDoubleGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/ValuesDoubleGroupingAggregatorFunction.java
@@ -72,6 +72,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -84,6 +88,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -143,6 +151,11 @@ private void addRawInput(int positionOffset, IntBlock groups, DoubleVector value
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/ValuesFloatGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/ValuesFloatGroupingAggregatorFunction.java
index 0c4e9c32328c7..f50c5a67d15a5 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/ValuesFloatGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/ValuesFloatGroupingAggregatorFunction.java
@@ -72,6 +72,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -84,6 +88,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -143,6 +151,11 @@ private void addRawInput(int positionOffset, IntBlock groups, FloatVector values
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/ValuesIntGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/ValuesIntGroupingAggregatorFunction.java
index 95e527c018cd1..c90fcedb291cf 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/ValuesIntGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/ValuesIntGroupingAggregatorFunction.java
@@ -70,6 +70,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -82,6 +86,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -141,6 +149,11 @@ private void addRawInput(int positionOffset, IntBlock groups, IntVector values)
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/ValuesLongGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/ValuesLongGroupingAggregatorFunction.java
index a7963447037a8..8a79cd7d942ee 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/ValuesLongGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/ValuesLongGroupingAggregatorFunction.java
@@ -72,6 +72,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -84,6 +88,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -143,6 +151,11 @@ private void addRawInput(int positionOffset, IntBlock groups, LongVector values)
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/spatial/SpatialCentroidCartesianPointDocValuesGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/spatial/SpatialCentroidCartesianPointDocValuesGroupingAggregatorFunction.java
index dc3c1cf2917ec..cc2fb38bb925c 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/spatial/SpatialCentroidCartesianPointDocValuesGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/spatial/SpatialCentroidCartesianPointDocValuesGroupingAggregatorFunction.java
@@ -81,6 +81,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -93,6 +97,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -152,6 +160,11 @@ private void addRawInput(int positionOffset, IntBlock groups, LongVector values)
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/spatial/SpatialCentroidCartesianPointSourceValuesGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/spatial/SpatialCentroidCartesianPointSourceValuesGroupingAggregatorFunction.java
index 0d1378ce988f3..6ae2b444efe98 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/spatial/SpatialCentroidCartesianPointSourceValuesGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/spatial/SpatialCentroidCartesianPointSourceValuesGroupingAggregatorFunction.java
@@ -84,6 +84,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -96,6 +100,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -159,6 +167,11 @@ private void addRawInput(int positionOffset, IntBlock groups, BytesRefVector val
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/spatial/SpatialCentroidGeoPointDocValuesGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/spatial/SpatialCentroidGeoPointDocValuesGroupingAggregatorFunction.java
index f5604e9e23200..0cce9b7cf1cd5 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/spatial/SpatialCentroidGeoPointDocValuesGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/spatial/SpatialCentroidGeoPointDocValuesGroupingAggregatorFunction.java
@@ -81,6 +81,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -93,6 +97,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -152,6 +160,11 @@ private void addRawInput(int positionOffset, IntBlock groups, LongVector values)
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/spatial/SpatialCentroidGeoPointSourceValuesGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/spatial/SpatialCentroidGeoPointSourceValuesGroupingAggregatorFunction.java
index b3caeef925a73..6c4d6635846df 100644
--- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/spatial/SpatialCentroidGeoPointSourceValuesGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/spatial/SpatialCentroidGeoPointSourceValuesGroupingAggregatorFunction.java
@@ -84,6 +84,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {
+ }
};
}
return new GroupingAggregatorFunction.AddInput() {
@@ -96,6 +100,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesVector);
}
+
+ @Override
+ public void close() {
+ }
};
}
@@ -159,6 +167,11 @@ private void addRawInput(int positionOffset, IntBlock groups, BytesRefVector val
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
state.enableGroupIdTracking(new SeenGroupIds.Empty());
diff --git a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/CountGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/CountGroupingAggregatorFunction.java
index 5dba070172ae9..f610abf271cfa 100644
--- a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/CountGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/CountGroupingAggregatorFunction.java
@@ -76,6 +76,9 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(positionOffset, groupIds, valuesBlock);
}
+
+ @Override
+ public void close() {}
};
}
}
@@ -89,6 +92,9 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addRawInput(groupIds);
}
+
+ @Override
+ public void close() {}
};
}
@@ -149,6 +155,11 @@ private void addRawInput(IntBlock groups) {
}
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ state.enableGroupIdTracking(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groups, Page page) {
assert channels.size() == intermediateBlockCount();
diff --git a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/FilteredAggregatorFunctionSupplier.java b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/FilteredAggregatorFunctionSupplier.java
new file mode 100644
index 0000000000000..c8a8696c03449
--- /dev/null
+++ b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/FilteredAggregatorFunctionSupplier.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0; you may not use this file except in compliance with the Elastic License
+ * 2.0.
+ */
+
+package org.elasticsearch.compute.aggregation;
+
+import org.elasticsearch.compute.operator.DriverContext;
+import org.elasticsearch.compute.operator.EvalOperator;
+import org.elasticsearch.core.Releasables;
+
+/**
+ * A {@link AggregatorFunctionSupplier} that wraps another, filtering which positions
+ * are supplied to the aggregator.
+ */
+public record FilteredAggregatorFunctionSupplier(AggregatorFunctionSupplier next, EvalOperator.ExpressionEvaluator.Factory filter)
+ implements
+ AggregatorFunctionSupplier {
+
+ @Override
+ public AggregatorFunction aggregator(DriverContext driverContext) {
+ throw new UnsupportedOperationException("TODO");
+ }
+
+ @Override
+ public GroupingAggregatorFunction groupingAggregator(DriverContext driverContext) {
+ GroupingAggregatorFunction next = this.next.groupingAggregator(driverContext);
+ EvalOperator.ExpressionEvaluator filter = null;
+ try {
+ filter = this.filter.get(driverContext);
+ GroupingAggregatorFunction result = new FilteredGroupingAggregatorFunction(next, filter);
+ next = null;
+ filter = null;
+ return result;
+ } finally {
+ Releasables.closeExpectNoException(next, filter);
+ }
+ }
+
+ @Override
+ public String describe() {
+ return "Filtered[next=" + next.describe() + ", filter=" + filter + "]";
+ }
+}
diff --git a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/FilteredGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/FilteredGroupingAggregatorFunction.java
new file mode 100644
index 0000000000000..c8dd80d7afe99
--- /dev/null
+++ b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/FilteredGroupingAggregatorFunction.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0; you may not use this file except in compliance with the Elastic License
+ * 2.0.
+ */
+
+package org.elasticsearch.compute.aggregation;
+
+import org.elasticsearch.compute.data.Block;
+import org.elasticsearch.compute.data.BooleanBlock;
+import org.elasticsearch.compute.data.BooleanVector;
+import org.elasticsearch.compute.data.IntBlock;
+import org.elasticsearch.compute.data.IntVector;
+import org.elasticsearch.compute.data.Page;
+import org.elasticsearch.compute.data.ToMask;
+import org.elasticsearch.compute.operator.DriverContext;
+import org.elasticsearch.compute.operator.EvalOperator;
+import org.elasticsearch.core.Releasables;
+
+import java.util.stream.IntStream;
+
+/**
+ * A {@link GroupingAggregatorFunction} that wraps another, filtering which positions
+ * are supplied to the aggregator.
+ */
+record FilteredGroupingAggregatorFunction(GroupingAggregatorFunction next, EvalOperator.ExpressionEvaluator filter)
+ implements
+ GroupingAggregatorFunction {
+
+ FilteredGroupingAggregatorFunction {
+ next.selectedMayContainUnseenGroups(new SeenGroupIds.Empty());
+ }
+
+ @Override
+ public AddInput prepareProcessPage(SeenGroupIds seenGroupIds, Page page) {
+ try (BooleanBlock filterResult = ((BooleanBlock) filter.eval(page))) {
+ ToMask mask = filterResult.toMask();
+ // TODO warn on mv fields
+ AddInput nextAdd = null;
+ try {
+ nextAdd = next.prepareProcessPage(seenGroupIds, page);
+ AddInput result = new FilteredAddInput(mask.mask(), nextAdd, page.getPositionCount());
+ mask = null;
+ nextAdd = null;
+ return result;
+ } finally {
+ Releasables.close(mask, nextAdd);
+ }
+ }
+ }
+
+ private record FilteredAddInput(BooleanVector mask, AddInput nextAdd, int positionCount) implements AddInput {
+ @Override
+ public void add(int positionOffset, IntBlock groupIds) {
+ if (positionOffset == 0) {
+ try (IntBlock filtered = groupIds.keepMask(mask)) {
+ nextAdd.add(positionOffset, filtered);
+ }
+ } else {
+ try (
+ BooleanVector offsetMask = mask.filter(
+ IntStream.range(positionOffset, positionOffset + groupIds.getPositionCount()).toArray()
+ );
+ IntBlock filtered = groupIds.keepMask(offsetMask)
+ ) {
+ nextAdd.add(positionOffset, filtered);
+ }
+ }
+ }
+
+ @Override
+ public void add(int positionOffset, IntVector groupIds) {
+ add(positionOffset, groupIds.asBlock());
+ }
+
+ @Override
+ public void close() {
+ Releasables.close(mask, nextAdd);
+ }
+ }
+
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ // nothing to do - we already put the underlying agg into this state
+ }
+
+ @Override
+ public void addIntermediateInput(int positionOffset, IntVector groupIdVector, Page page) {
+ next.addIntermediateInput(positionOffset, groupIdVector, page);
+ }
+
+ @Override
+ public void addIntermediateRowInput(int groupId, GroupingAggregatorFunction input, int position) {
+ next.addIntermediateRowInput(groupId, input, position);
+ }
+
+ @Override
+ public void evaluateIntermediate(Block[] blocks, int offset, IntVector selected) {
+ next.evaluateIntermediate(blocks, offset, selected);
+ }
+
+ @Override
+ public void evaluateFinal(Block[] blocks, int offset, IntVector selected, DriverContext driverContext) {
+ next.evaluateFinal(blocks, offset, selected, driverContext);
+ }
+
+ @Override
+ public int intermediateBlockCount() {
+ return next.intermediateBlockCount();
+ }
+
+ @Override
+ public void close() {
+ Releasables.closeExpectNoException(next, filter);
+ }
+}
diff --git a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/FromPartialGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/FromPartialGroupingAggregatorFunction.java
index 675fbe88f1984..5c1a223404564 100644
--- a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/FromPartialGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/FromPartialGroupingAggregatorFunction.java
@@ -51,9 +51,17 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
addIntermediateInput(positionOffset, groupIds, page);
}
+
+ @Override
+ public void close() {}
};
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ delegate.selectedMayContainUnseenGroups(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groupIdVector, Page page) {
final CompositeBlock inputBlock = page.getBlock(inputChannel);
diff --git a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/GroupingAggregator.java b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/GroupingAggregator.java
index 21bcded6caee1..3612ca9996192 100644
--- a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/GroupingAggregator.java
+++ b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/GroupingAggregator.java
@@ -49,6 +49,9 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
aggregatorFunction.addIntermediateInput(positionOffset, groupIds, page);
}
+
+ @Override
+ public void close() {}
};
} else {
return aggregatorFunction.prepareProcessPage(seenGroupIds, page);
diff --git a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/GroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/GroupingAggregatorFunction.java
index b2f8e6b1bc33d..fbd2ddaa816b7 100644
--- a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/GroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/GroupingAggregatorFunction.java
@@ -24,7 +24,7 @@ public interface GroupingAggregatorFunction extends Releasable {
* Consume group ids to cause the {@link GroupingAggregatorFunction}
* to group values at a particular position into a particular group.
*/
- interface AddInput {
+ interface AddInput extends Releasable {
/**
* Send a batch of group ids to the aggregator. The {@code groupIds}
* may be offset from the start of the block to allow for sending chunks
@@ -43,6 +43,12 @@ interface AddInput {
* {@code groupIds} {@linkplain Block} that contains thousands of
* values at a single positions.
*
+ *
+ * Finally, it's possible for a single position to be collected into
+ * groupIds. In that case it's positionOffset may
+ * be skipped entirely or the groupIds block could contain a
+ * {@code null} value at that position.
+ *
* @param positionOffset offset into the {@link Page} used to build this
* {@link AddInput} of these ids
* @param groupIds {@link Block} of group id, some of which may be null
@@ -68,7 +74,7 @@ interface AddInput {
}
/**
- * Prepare to process a single page of results.
+ * Prepare to process a single page of input.
*
* This should load the input {@link Block}s and check their types and
* select an optimal path and return that path as an {@link AddInput}.
@@ -76,6 +82,16 @@ interface AddInput {
*/
AddInput prepareProcessPage(SeenGroupIds seenGroupIds, Page page); // TODO allow returning null to opt out of the callback loop
+ /**
+ * Call this to signal to the aggregation that the {@code selected}
+ * parameter that's passed to {@link #evaluateIntermediate} or
+ * {@link #evaluateFinal} may reference groups that haven't been
+ * seen. This puts the underlying storage into a mode where it'll
+ * track which group ids have been seen, even if that increases the
+ * overhead.
+ */
+ void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds);
+
/**
* Add data produced by {@link #evaluateIntermediate}.
*/
diff --git a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/ToPartialGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/ToPartialGroupingAggregatorFunction.java
index 13d4bd5d6c0d6..18b907a3d7080 100644
--- a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/ToPartialGroupingAggregatorFunction.java
+++ b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/ToPartialGroupingAggregatorFunction.java
@@ -60,6 +60,11 @@ public AddInput prepareProcessPage(SeenGroupIds seenGroupIds, Page page) {
return delegate.prepareProcessPage(seenGroupIds, page);
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ delegate.selectedMayContainUnseenGroups(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groupIdVector, Page page) {
final CompositeBlock inputBlock = page.getBlock(channels.get(0));
diff --git a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/blockhash/AddBlock.java b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/blockhash/AddBlock.java
index 786c61e6f602a..496624fc1189d 100644
--- a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/blockhash/AddBlock.java
+++ b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/blockhash/AddBlock.java
@@ -13,6 +13,7 @@
import org.elasticsearch.compute.data.IntBlock;
import org.elasticsearch.compute.data.Page;
import org.elasticsearch.core.Releasable;
+import org.elasticsearch.core.Releasables;
/**
* Helper for adding a {@link Page} worth of {@link Block}s to a {@link BlockHash}
@@ -149,6 +150,6 @@ private void rollover(int position) {
@Override
public void close() {
- ords.close();
+ Releasables.closeExpectNoException(ords, addInput);
}
}
diff --git a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/table/BlockHashRowInTableLookup.java b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/table/BlockHashRowInTableLookup.java
index 1acd1c30ed334..c198853bb36ad 100644
--- a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/table/BlockHashRowInTableLookup.java
+++ b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/table/BlockHashRowInTableLookup.java
@@ -65,6 +65,9 @@ public void add(int positionOffset, IntVector groupIds) {
lastOrd = ord;
}
}
+
+ @Override
+ public void close() {}
});
success = true;
} finally {
diff --git a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/operator/HashAggregationOperator.java b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/operator/HashAggregationOperator.java
index 42bc75a49f4a7..03a4ca2b0ad5e 100644
--- a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/operator/HashAggregationOperator.java
+++ b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/operator/HashAggregationOperator.java
@@ -150,18 +150,23 @@ private void end() {
hashStart = System.nanoTime();
aggregationNanos += hashStart - aggStart;
}
+
+ @Override
+ public void close() {
+ Releasables.closeExpectNoException(prepared);
+ }
}
- AddInput add = new AddInput();
+ try (AddInput add = new AddInput()) {
+ checkState(needsInput(), "Operator is already finishing");
+ requireNonNull(page, "page is null");
- checkState(needsInput(), "Operator is already finishing");
- requireNonNull(page, "page is null");
+ for (int i = 0; i < prepared.length; i++) {
+ prepared[i] = aggregators.get(i).prepareProcessPage(blockHash, page);
+ }
- for (int i = 0; i < prepared.length; i++) {
- prepared[i] = aggregators.get(i).prepareProcessPage(blockHash, page);
+ blockHash.add(wrapPage(page), add);
+ hashNanos += System.nanoTime() - add.hashStart;
}
-
- blockHash.add(wrapPage(page), add);
- hashNanos += System.nanoTime() - add.hashStart;
} finally {
page.releaseBlocks();
pagesProcessed++;
diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/aggregation/FilteredGroupingAggregatorFunctionTests.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/aggregation/FilteredGroupingAggregatorFunctionTests.java
new file mode 100644
index 0000000000000..7b924076c0186
--- /dev/null
+++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/aggregation/FilteredGroupingAggregatorFunctionTests.java
@@ -0,0 +1,169 @@
+/*
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
+ * or more contributor license agreements. Licensed under the Elastic License
+ * 2.0; you may not use this file except in compliance with the Elastic License
+ * 2.0.
+ */
+
+package org.elasticsearch.compute.aggregation;
+
+import org.elasticsearch.compute.data.Block;
+import org.elasticsearch.compute.data.BlockFactory;
+import org.elasticsearch.compute.data.BooleanVector;
+import org.elasticsearch.compute.data.IntBlock;
+import org.elasticsearch.compute.data.LongBlock;
+import org.elasticsearch.compute.data.Page;
+import org.elasticsearch.compute.operator.DriverContext;
+import org.elasticsearch.compute.operator.EvalOperator;
+import org.elasticsearch.compute.operator.LongIntBlockSourceOperator;
+import org.elasticsearch.compute.operator.SourceOperator;
+import org.elasticsearch.core.Tuple;
+import org.junit.After;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.IntStream;
+
+import static org.hamcrest.Matchers.empty;
+import static org.hamcrest.Matchers.equalTo;
+
+public class FilteredGroupingAggregatorFunctionTests extends GroupingAggregatorFunctionTestCase {
+ private final List unclosed = Collections.synchronizedList(new ArrayList<>());
+
+ // TODO some version of this test that applies across all aggs
+ @Override
+ protected AggregatorFunctionSupplier aggregatorFunction(List inputChannels) {
+ return new FilteredAggregatorFunctionSupplier(
+ new SumIntAggregatorFunctionSupplier(inputChannels),
+ new AnyGreaterThanFactory(unclosed, inputChannels)
+ );
+ }
+
+ @Override
+ protected String expectedDescriptionOfAggregator() {
+ return "Filtered[next=sum of ints, filter=any > 0]";
+ }
+
+ @Override
+ protected String expectedToStringOfSimpleAggregator() {
+ return "FilteredGroupingAggregatorFunction[next=SumIntGroupingAggregatorFunction[channels=[1]], filter=any > 0]";
+ }
+
+ @Override
+ protected void assertSimpleGroup(List input, Block result, int position, Long group) {
+ long sum = 0;
+ for (Page page : input) {
+ LongBlock groups = page.getBlock(0);
+ IntBlock ints = page.getBlock(1);
+ for (int p = 0; p < ints.getPositionCount(); p++) {
+ /*
+ * Perform the sum on the values *only* if:
+ * 1. Any of the values is > 0 to line up with the condition
+ * 2. Any of the groups matches the group we're asserting
+ */
+ int start = ints.getFirstValueIndex(p);
+ int end = start + ints.getValueCount(p);
+ boolean selected = false;
+ for (int i = start; i < end; i++) {
+ selected |= ints.getInt(i) > 0;
+ }
+ if (selected == false) {
+ continue;
+ }
+ selected = false;
+ if (group == null) {
+ selected = groups.isNull(p);
+ } else {
+ start = groups.getFirstValueIndex(p);
+ end = start + groups.getValueCount(p);
+ for (int i = start; i < end; i++) {
+ selected |= groups.getLong(i) == group;
+ }
+ }
+ if (selected == false) {
+ continue;
+ }
+
+ start = ints.getFirstValueIndex(p);
+ end = start + ints.getValueCount(p);
+ for (int i = start; i < end; i++) {
+ sum += ints.getInt(i);
+ }
+ }
+ }
+ assertThat(((LongBlock) result).getLong(position), equalTo(sum));
+ }
+
+ @Override
+ protected SourceOperator simpleInput(BlockFactory blockFactory, int size) {
+ int max = between(1, Integer.MAX_VALUE / size / 5);
+ return new LongIntBlockSourceOperator(
+ blockFactory,
+ IntStream.range(0, size).mapToObj(l -> Tuple.tuple(randomLongBetween(0, 4), between(-max, max)))
+ );
+ }
+
+ @After
+ public void checkUnclosed() {
+ for (Exception tracker : unclosed) {
+ logger.error("unclosed", tracker);
+ }
+ assertThat(unclosed, empty());
+ }
+
+ /**
+ * This checks if *any* of the integers are > 0. If so we push the group to
+ * the aggregation.
+ */
+ private record AnyGreaterThanFactory(List unclosed, List inputChannels)
+ implements
+ EvalOperator.ExpressionEvaluator.Factory {
+ @Override
+ public EvalOperator.ExpressionEvaluator get(DriverContext context) {
+ Exception tracker = new Exception(Integer.toString(unclosed.size()));
+ unclosed.add(tracker);
+ return new AnyGreaterThan(context.blockFactory(), unclosed, tracker, inputChannels);
+ }
+
+ @Override
+ public String toString() {
+ return "any > 0";
+ }
+ }
+
+ private record AnyGreaterThan(BlockFactory blockFactory, List unclosed, Exception tracker, List inputChannels)
+ implements
+ EvalOperator.ExpressionEvaluator {
+ @Override
+ public Block eval(Page page) {
+ IntBlock ints = page.getBlock(inputChannels.get(0));
+ try (BooleanVector.FixedBuilder result = blockFactory.newBooleanVectorFixedBuilder(ints.getPositionCount())) {
+ position: for (int p = 0; p < ints.getPositionCount(); p++) {
+ int start = ints.getFirstValueIndex(p);
+ int end = start + ints.getValueCount(p);
+ for (int i = start; i < end; i++) {
+ if (ints.getInt(i) > 0) {
+ result.appendBoolean(p, true);
+ continue position;
+ }
+ }
+ result.appendBoolean(p, false);
+ }
+ return result.build().asBlock();
+ }
+ }
+
+ @Override
+ public void close() {
+ if (unclosed.remove(tracker) == false) {
+ throw new IllegalStateException("close failure!");
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "any > 0";
+ }
+ }
+}
diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/aggregation/GroupingAggregatorFunctionTestCase.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/aggregation/GroupingAggregatorFunctionTestCase.java
index f6558d54b2779..de9337f5fce2c 100644
--- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/aggregation/GroupingAggregatorFunctionTestCase.java
+++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/aggregation/GroupingAggregatorFunctionTestCase.java
@@ -52,11 +52,14 @@
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasSize;
+/**
+ * Shared tests for testing grouped aggregations.
+ */
public abstract class GroupingAggregatorFunctionTestCase extends ForkingOperatorTestCase {
protected abstract AggregatorFunctionSupplier aggregatorFunction(List inputChannels);
protected final int aggregatorIntermediateBlockCount() {
- try (var agg = aggregatorFunction(List.of()).aggregator(driverContext())) {
+ try (var agg = aggregatorFunction(List.of()).groupingAggregator(driverContext())) {
return agg.intermediateBlockCount();
}
}
@@ -101,16 +104,20 @@ protected final Matcher expectedDescriptionOfSimple() {
@Override
protected final Matcher expectedToStringOfSimple() {
String hash = "blockHash=LongBlockHash{channel=0, entries=0, seenNull=false}";
- String type = getClass().getSimpleName().replace("Tests", "");
return equalTo(
"HashAggregationOperator["
+ hash
+ ", aggregators=[GroupingAggregator[aggregatorFunction="
- + type
- + "[channels=[1]], mode=SINGLE]]]"
+ + expectedToStringOfSimpleAggregator()
+ + ", mode=SINGLE]]]"
);
}
+ protected String expectedToStringOfSimpleAggregator() {
+ String type = getClass().getSimpleName().replace("Tests", "");
+ return type + "[channels=[1]]";
+ }
+
private SeenGroups seenGroups(List input) {
boolean seenNullGroup = false;
SortedSet seenGroups = new TreeSet<>();
@@ -544,7 +551,7 @@ public GroupingAggregatorFunction groupingAggregator(DriverContext driverContext
@Override
public AddInput prepareProcessPage(SeenGroupIds ignoredSeenGroupIds, Page page) {
return new AddInput() {
- AddInput delegateAddInput = delegate.prepareProcessPage(bigArrays -> {
+ final AddInput delegateAddInput = delegate.prepareProcessPage(bigArrays -> {
BitArray seen = new BitArray(0, bigArrays);
seen.or(seenGroupIds);
return seen;
@@ -595,9 +602,19 @@ public void add(int positionOffset, IntVector groupIds) {
delegateAddInput.add(positionOffset + offset, blockFactory.newIntArrayVector(chunk, count));
}
}
+
+ @Override
+ public void close() {
+ delegateAddInput.close();
+ }
};
}
+ @Override
+ public void selectedMayContainUnseenGroups(SeenGroupIds seenGroupIds) {
+ delegate.selectedMayContainUnseenGroups(seenGroupIds);
+ }
+
@Override
public void addIntermediateInput(int positionOffset, IntVector groupIds, Page page) {
int[] chunk = new int[emitChunkSize];
diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/aggregation/blockhash/AddBlockTests.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/aggregation/blockhash/AddBlockTests.java
index fbe696aa2997b..da9529cb761ef 100644
--- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/aggregation/blockhash/AddBlockTests.java
+++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/aggregation/blockhash/AddBlockTests.java
@@ -39,6 +39,7 @@ public void testSv() {
}
expected.add(added(3, 4));
assertThat(result.added, equalTo(expected));
+ assertThat(result.closed, equalTo(true));
}
public void testMvBlockEndsOnBatchBoundary() {
@@ -62,6 +63,7 @@ public void testMvBlockEndsOnBatchBoundary() {
// We uselessly flush an empty position if emitBatchSize lines up with the total count
expected.add(new Added(1, List.of(List.of())));
assertThat(result.added, equalTo(expected));
+ assertThat(result.closed, equalTo(true));
}
public void testMvPositionEndOnBatchBoundary() {
@@ -83,6 +85,7 @@ public void testMvPositionEndOnBatchBoundary() {
// Because the first position ended on a block boundary we uselessly emit an empty position there
expected.add(new Added(0, List.of(List.of(), List.of(0, 2))));
assertThat(result.added, equalTo(expected));
+ assertThat(result.closed, equalTo(true));
}
public void testMv() {
@@ -103,6 +106,7 @@ public void testMv() {
}
expected.add(new Added(1, List.of(List.of(2))));
assertThat(result.added, equalTo(expected));
+ assertThat(result.closed, equalTo(true));
}
@After
@@ -117,6 +121,8 @@ Added added(int positionOffset, int... ords) {
}
private class TestAddInput implements GroupingAggregatorFunction.AddInput {
+ private boolean closed = false;
+
private final List added = new ArrayList<>();
@Override
@@ -139,5 +145,10 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
add(positionOffset, groupIds.asBlock());
}
+
+ @Override
+ public void close() {
+ closed = true;
+ }
}
}
diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/aggregation/blockhash/BlockHashTests.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/aggregation/blockhash/BlockHashTests.java
index 259d4f1249d69..c4042ea15afc6 100644
--- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/aggregation/blockhash/BlockHashTests.java
+++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/aggregation/blockhash/BlockHashTests.java
@@ -1166,6 +1166,9 @@ public void add(int positionOffset, IntVector groupIds) {
groupIds.incRef();
output1.add(new Output(positionOffset, null, groupIds));
}
+
+ @Override
+ public void close() {}
});
hash2.add(page, new GroupingAggregatorFunction.AddInput() {
@Override
@@ -1179,6 +1182,9 @@ public void add(int positionOffset, IntVector groupIds) {
groupIds.incRef();
output2.add(new Output(positionOffset, null, groupIds));
}
+
+ @Override
+ public void close() {}
});
assertThat(output1.size(), equalTo(output1.size()));
for (int i = 0; i < output1.size(); i++) {
@@ -1297,6 +1303,9 @@ public void add(int positionOffset, IntBlock groupIds) {
public void add(int positionOffset, IntVector groupIds) {
add(positionOffset, groupIds.asBlock());
}
+
+ @Override
+ public void close() {}
});
if (blockHash instanceof LongLongBlockHash == false
&& blockHash instanceof BytesRefLongBlockHash == false
diff --git a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/AbstractAggregationTestCase.java b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/AbstractAggregationTestCase.java
index 54db9afa291ad..eb9f10f7b2e0f 100644
--- a/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/AbstractAggregationTestCase.java
+++ b/x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/AbstractAggregationTestCase.java
@@ -11,6 +11,7 @@
import org.elasticsearch.compute.aggregation.AggregatorFunctionSupplier;
import org.elasticsearch.compute.aggregation.AggregatorMode;
import org.elasticsearch.compute.aggregation.GroupingAggregator;
+import org.elasticsearch.compute.aggregation.GroupingAggregatorFunction;
import org.elasticsearch.compute.aggregation.SeenGroupIds;
import org.elasticsearch.compute.data.Block;
import org.elasticsearch.compute.data.ElementType;
@@ -455,22 +456,26 @@ private void processPageGrouping(GroupingAggregator aggregator, Page inputPage,
for (int currentGroupOffset = 0; currentGroupOffset < groupCount;) {
int groupSliceRemainingSize = Math.min(groupSliceSize, groupCount - currentGroupOffset);
var seenGroupIds = new SeenGroupIds.Range(0, allValuesNull ? 0 : currentGroupOffset + groupSliceRemainingSize);
- var addInput = aggregator.prepareProcessPage(seenGroupIds, inputPage);
-
- var positionCount = inputPage.getPositionCount();
- var dataSliceSize = 1;
- // Divide data in chunks
- for (int currentDataOffset = 0; currentDataOffset < positionCount;) {
- int dataSliceRemainingSize = Math.min(dataSliceSize, positionCount - currentDataOffset);
- try (
- var groups = makeGroupsVector(currentGroupOffset, currentGroupOffset + groupSliceRemainingSize, dataSliceRemainingSize)
- ) {
- addInput.add(currentDataOffset, groups);
- }
+ try (GroupingAggregatorFunction.AddInput addInput = aggregator.prepareProcessPage(seenGroupIds, inputPage)) {
+ var positionCount = inputPage.getPositionCount();
+ var dataSliceSize = 1;
+ // Divide data in chunks
+ for (int currentDataOffset = 0; currentDataOffset < positionCount;) {
+ int dataSliceRemainingSize = Math.min(dataSliceSize, positionCount - currentDataOffset);
+ try (
+ var groups = makeGroupsVector(
+ currentGroupOffset,
+ currentGroupOffset + groupSliceRemainingSize,
+ dataSliceRemainingSize
+ )
+ ) {
+ addInput.add(currentDataOffset, groups);
+ }
- currentDataOffset += dataSliceSize;
- if (positionCount > currentDataOffset) {
- dataSliceSize = randomIntBetween(1, Math.min(100, positionCount - currentDataOffset));
+ currentDataOffset += dataSliceSize;
+ if (positionCount > currentDataOffset) {
+ dataSliceSize = randomIntBetween(1, Math.min(100, positionCount - currentDataOffset));
+ }
}
}