Skip to content

Commit fc54ebb

Browse files
committed
Implement custom add in HashAggregationOperator
(cherry picked from commit fb670bd)
1 parent ff01cde commit fc54ebb

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/operator/HashAggregationOperator.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,11 @@
2020
import org.elasticsearch.compute.aggregation.GroupingAggregatorFunction;
2121
import org.elasticsearch.compute.aggregation.blockhash.BlockHash;
2222
import org.elasticsearch.compute.data.Block;
23+
import org.elasticsearch.compute.data.IntArrayBlock;
24+
import org.elasticsearch.compute.data.IntBigArrayBlock;
2325
import org.elasticsearch.compute.data.IntBlock;
2426
import org.elasticsearch.compute.data.IntVector;
27+
import org.elasticsearch.compute.data.IntVectorBlock;
2528
import org.elasticsearch.compute.data.Page;
2629
import org.elasticsearch.core.Releasables;
2730
import org.elasticsearch.core.TimeValue;
@@ -158,6 +161,30 @@ public void add(int positionOffset, IntBlock groupIds) {
158161
}
159162
}
160163

164+
@Override
165+
public void add(int positionOffset, IntVectorBlock groupIds) {
166+
IntVector groupIdsVector = groupIds.asVector();
167+
add(positionOffset, groupIdsVector);
168+
}
169+
170+
@Override
171+
public void add(int positionOffset, IntArrayBlock groupIds) {
172+
startAggEndHash();
173+
for (GroupingAggregatorFunction.AddInput p : prepared) {
174+
p.add(positionOffset, groupIds);
175+
}
176+
end();
177+
}
178+
179+
@Override
180+
public void add(int positionOffset, IntBigArrayBlock groupIds) {
181+
startAggEndHash();
182+
for (GroupingAggregatorFunction.AddInput p : prepared) {
183+
p.add(positionOffset, groupIds);
184+
}
185+
end();
186+
}
187+
161188
@Override
162189
public void add(int positionOffset, IntVector groupIds) {
163190
startAggEndHash();

0 commit comments

Comments
 (0)