Skip to content

Commit ff01cde

Browse files
committed
Call the specific add() methods for eacj block type
(cherry picked from commit 5176663)
1 parent ba2f5ea commit ff01cde

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/GroupingAggregatorFunction.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,26 @@ default void add(int positionOffset, IntBigArrayBlock groupIds) {
8888
add(positionOffset, (IntBlock) groupIds);
8989
}
9090

91+
/**
92+
* Calls an {@code add()} implementation given the specific {@code groupIds} block type.
93+
*/
94+
default void addSpecific(int positionOffset, IntBlock groupIds) {
95+
switch (groupIds) {
96+
case IntVectorBlock b:
97+
add(positionOffset, b);
98+
break;
99+
case IntArrayBlock b:
100+
add(positionOffset, b);
101+
break;
102+
case IntBigArrayBlock b:
103+
add(positionOffset, b);
104+
break;
105+
default:
106+
add(positionOffset, groupIds);
107+
break;
108+
}
109+
}
110+
91111
/**
92112
* Send a batch of group ids to the aggregator. The {@code groupIds}
93113
* may be offset from the start of the block to allow for sending chunks

0 commit comments

Comments
 (0)