Skip to content

Commit ba2f5ea

Browse files
committed
Specialize block parameters on AddInput
(cherry picked from commit a5855c1)
1 parent 51959da commit ba2f5ea

File tree

79 files changed

+10525
-856
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+10525
-856
lines changed

x-pack/plugin/esql/compute/gen/src/main/java/org/elasticsearch/compute/gen/GroupingAggregatorImplementer.java

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,11 @@
5454
import static org.elasticsearch.compute.gen.Types.GROUPING_AGGREGATOR_FUNCTION;
5555
import static org.elasticsearch.compute.gen.Types.GROUPING_AGGREGATOR_FUNCTION_ADD_INPUT;
5656
import static org.elasticsearch.compute.gen.Types.INTERMEDIATE_STATE_DESC;
57+
import static org.elasticsearch.compute.gen.Types.INT_ARRAY_BLOCK;
58+
import static org.elasticsearch.compute.gen.Types.INT_BIG_ARRAY_BLOCK;
5759
import static org.elasticsearch.compute.gen.Types.INT_BLOCK;
5860
import static org.elasticsearch.compute.gen.Types.INT_VECTOR;
61+
import static org.elasticsearch.compute.gen.Types.INT_VECTOR_BLOCK;
5962
import static org.elasticsearch.compute.gen.Types.LIST_AGG_FUNC_DESC;
6063
import static org.elasticsearch.compute.gen.Types.LIST_INTEGER;
6164
import static org.elasticsearch.compute.gen.Types.LONG_BLOCK;
@@ -76,6 +79,9 @@
7679
* and break-point-able as possible.
7780
*/
7881
public class GroupingAggregatorImplementer {
82+
private static final List<ClassName> GROUP_IDS_CLASSES =
83+
List.of(INT_BLOCK, INT_ARRAY_BLOCK, INT_VECTOR_BLOCK, INT_BIG_ARRAY_BLOCK, INT_VECTOR);
84+
7985
private final TypeElement declarationType;
8086
private final List<TypeMirror> warnExceptions;
8187
private final ExecutableElement init;
@@ -196,10 +202,10 @@ private TypeSpec type() {
196202
builder.addMethod(intermediateStateDesc());
197203
builder.addMethod(intermediateBlockCount());
198204
builder.addMethod(prepareProcessPage());
199-
builder.addMethod(addRawInputLoop(INT_VECTOR, blockType(aggParam.type())));
200-
builder.addMethod(addRawInputLoop(INT_VECTOR, vectorType(aggParam.type())));
201-
builder.addMethod(addRawInputLoop(INT_BLOCK, blockType(aggParam.type())));
202-
builder.addMethod(addRawInputLoop(INT_BLOCK, vectorType(aggParam.type())));
205+
for (ClassName groupIdClass : GROUP_IDS_CLASSES) {
206+
builder.addMethod(addRawInputLoop(groupIdClass, blockType(aggParam.type())));
207+
builder.addMethod(addRawInputLoop(groupIdClass, vectorType(aggParam.type())));
208+
}
203209
builder.addMethod(selectedMayContainUnseenGroups());
204210
builder.addMethod(addIntermediateInput());
205211
builder.addMethod(addIntermediateRowInput());
@@ -347,15 +353,12 @@ private TypeSpec addInput(Consumer<MethodSpec.Builder> addBlock) {
347353
TypeSpec.Builder builder = TypeSpec.anonymousClassBuilder("");
348354
builder.addSuperinterface(GROUPING_AGGREGATOR_FUNCTION_ADD_INPUT);
349355

350-
MethodSpec.Builder block = MethodSpec.methodBuilder("add").addAnnotation(Override.class).addModifiers(Modifier.PUBLIC);
351-
block.addParameter(TypeName.INT, "positionOffset").addParameter(INT_BLOCK, "groupIds");
352-
addBlock.accept(block);
353-
builder.addMethod(block.build());
354-
355-
MethodSpec.Builder vector = MethodSpec.methodBuilder("add").addAnnotation(Override.class).addModifiers(Modifier.PUBLIC);
356-
vector.addParameter(TypeName.INT, "positionOffset").addParameter(INT_VECTOR, "groupIds");
357-
addBlock.accept(vector);
358-
builder.addMethod(vector.build());
356+
for (ClassName groupIdsType : GROUP_IDS_CLASSES) {
357+
MethodSpec.Builder vector = MethodSpec.methodBuilder("add").addAnnotation(Override.class).addModifiers(Modifier.PUBLIC);
358+
vector.addParameter(TypeName.INT, "positionOffset").addParameter(groupIdsType, "groupIds");
359+
addBlock.accept(vector);
360+
builder.addMethod(vector.build());
361+
}
359362

360363
MethodSpec.Builder close = MethodSpec.methodBuilder("close").addAnnotation(Override.class).addModifiers(Modifier.PUBLIC);
361364
builder.addMethod(close.build());

x-pack/plugin/esql/compute/gen/src/main/java/org/elasticsearch/compute/gen/Types.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ public class Types {
4646
static final ClassName BOOLEAN_BLOCK = ClassName.get(DATA_PACKAGE, "BooleanBlock");
4747
static final ClassName BYTES_REF_BLOCK = ClassName.get(DATA_PACKAGE, "BytesRefBlock");
4848
static final ClassName INT_BLOCK = ClassName.get(DATA_PACKAGE, "IntBlock");
49+
static final ClassName INT_VECTOR_BLOCK = ClassName.get(DATA_PACKAGE, "IntVectorBlock");
50+
static final ClassName INT_ARRAY_BLOCK = ClassName.get(DATA_PACKAGE, "IntArrayBlock");
51+
static final ClassName INT_BIG_ARRAY_BLOCK = ClassName.get(DATA_PACKAGE, "IntBigArrayBlock");
4952
static final ClassName LONG_BLOCK = ClassName.get(DATA_PACKAGE, "LongBlock");
5053
static final ClassName DOUBLE_BLOCK = ClassName.get(DATA_PACKAGE, "DoubleBlock");
5154
static final ClassName FLOAT_BLOCK = ClassName.get(DATA_PACKAGE, "FloatBlock");

x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/BooleanArrayBlock.java

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/BytesRefArrayBlock.java

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/DoubleArrayBlock.java

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/FloatArrayBlock.java

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/IntArrayBlock.java

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/LongArrayBlock.java

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 150 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)