Skip to content

Commit e9bef0d

Browse files
authored
ESQL: Normalize timeseries aggs slightly (#132284)
Time series aggregations needed a method like: ``` static Block evaluateFinal( GroupingState state, IntVector selected, GroupingAggregatorEvaluationContext ctx ) ``` and other aggregations needed to write it: ``` static Block evaluateFinal( GroupingState state, IntVector selected, DriverContext ctx ) ``` While slightly shorter, it isn't worth having two ways to do it. This is purely mechanical change to make everything work like the time series aggregations. It also adds a few more of the "we're not sorting these imports" comments to the template generated classes. Relates to #108385
1 parent 079cff5 commit e9bef0d

File tree

141 files changed

+353
-297
lines changed

Some content is hidden

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

141 files changed

+353
-297
lines changed

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

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -726,11 +726,11 @@ private MethodSpec evaluateFinal() {
726726
.addParameter(BLOCK_ARRAY, "blocks")
727727
.addParameter(TypeName.INT, "offset")
728728
.addParameter(INT_VECTOR, "selected")
729-
.addParameter(GROUPING_AGGREGATOR_EVALUATOR_CONTEXT, "evaluatorContext");
729+
.addParameter(GROUPING_AGGREGATOR_EVALUATOR_CONTEXT, "ctx");
730730

731731
if (aggState.declaredType().isPrimitive()) {
732-
builder.addStatement("blocks[offset] = state.toValuesBlock(selected, evaluatorContext.driverContext())");
733-
} else if (timseries) {
732+
builder.addStatement("blocks[offset] = state.toValuesBlock(selected, ctx.driverContext())");
733+
} else {
734734
requireStaticMethod(
735735
declarationType,
736736
requireType(BLOCK),
@@ -741,15 +741,7 @@ private MethodSpec evaluateFinal() {
741741
requireType(GROUPING_AGGREGATOR_EVALUATOR_CONTEXT)
742742
)
743743
);
744-
builder.addStatement("blocks[offset] = $T.evaluateFinal(state, selected, evaluatorContext)", declarationType);
745-
} else {
746-
requireStaticMethod(
747-
declarationType,
748-
requireType(BLOCK),
749-
requireName("evaluateFinal"),
750-
requireArgs(requireType(aggState.declaredType()), requireType(INT_VECTOR), requireType(DRIVER_CONTEXT))
751-
);
752-
builder.addStatement("blocks[offset] = $T.evaluateFinal(state, selected, evaluatorContext.driverContext())", declarationType);
744+
builder.addStatement("blocks[offset] = $T.evaluateFinal(state, selected, ctx)", declarationType);
753745
}
754746
return builder.build();
755747
}

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

Lines changed: 4 additions & 2 deletions
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/aggregation/FirstOverTimeFloatAggregator.java

Lines changed: 4 additions & 2 deletions
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/aggregation/FirstOverTimeIntAggregator.java

Lines changed: 4 additions & 2 deletions
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/aggregation/FirstOverTimeLongAggregator.java

Lines changed: 6 additions & 2 deletions
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/aggregation/LastOverTimeDoubleAggregator.java

Lines changed: 4 additions & 2 deletions
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/aggregation/LastOverTimeFloatAggregator.java

Lines changed: 4 additions & 2 deletions
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/aggregation/LastOverTimeIntAggregator.java

Lines changed: 4 additions & 2 deletions
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/aggregation/LastOverTimeLongAggregator.java

Lines changed: 6 additions & 2 deletions
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/aggregation/RateDoubleAggregator.java

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

0 commit comments

Comments
 (0)