Skip to content

Commit 618082b

Browse files
committed
ESQL: Normalize timeseries aggs slightly
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 f8d97f3 commit 618082b

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
@@ -724,11 +724,11 @@ private MethodSpec evaluateFinal() {
724724
.addParameter(BLOCK_ARRAY, "blocks")
725725
.addParameter(TypeName.INT, "offset")
726726
.addParameter(INT_VECTOR, "selected")
727-
.addParameter(GROUPING_AGGREGATOR_EVALUATOR_CONTEXT, "evaluatorContext");
727+
.addParameter(GROUPING_AGGREGATOR_EVALUATOR_CONTEXT, "ctx");
728728

729729
if (aggState.declaredType().isPrimitive()) {
730-
builder.addStatement("blocks[offset] = state.toValuesBlock(selected, evaluatorContext.driverContext())");
731-
} else if (timseries) {
730+
builder.addStatement("blocks[offset] = state.toValuesBlock(selected, ctx.driverContext())");
731+
} else {
732732
requireStaticMethod(
733733
declarationType,
734734
requireType(BLOCK),
@@ -739,15 +739,7 @@ private MethodSpec evaluateFinal() {
739739
requireType(GROUPING_AGGREGATOR_EVALUATOR_CONTEXT)
740740
)
741741
);
742-
builder.addStatement("blocks[offset] = $T.evaluateFinal(state, selected, evaluatorContext)", declarationType);
743-
} else {
744-
requireStaticMethod(
745-
declarationType,
746-
requireType(BLOCK),
747-
requireName("evaluateFinal"),
748-
requireArgs(requireType(aggState.declaredType()), requireType(INT_VECTOR), requireType(DRIVER_CONTEXT))
749-
);
750-
builder.addStatement("blocks[offset] = $T.evaluateFinal(state, selected, evaluatorContext.driverContext())", declarationType);
742+
builder.addStatement("blocks[offset] = $T.evaluateFinal(state, selected, ctx)", declarationType);
751743
}
752744
return builder.build();
753745
}

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)