diff --git a/x-pack/plugin/esql/compute/build.gradle b/x-pack/plugin/esql/compute/build.gradle index ebdf3074e9c8b..435069a20f533 100644 --- a/x-pack/plugin/esql/compute/build.gradle +++ b/x-pack/plugin/esql/compute/build.gradle @@ -900,28 +900,28 @@ tasks.named('stringTemplates').configure { } // TODO: add {value}_over_time for other types: boolean, bytes_refs - File valueOverTimeAggregatorInputFile = file("src/main/java/org/elasticsearch/compute/aggregation/X-ValueOverTimeAggregator.java.st") + File valueByTimestampAggregatorInputFile = file("src/main/java/org/elasticsearch/compute/aggregation/X-ValueByTimestampAggregator.java.st") ["First", "Last"].forEach { Occurrence -> { template { it.properties = addOccurrence(intProperties, Occurrence) - it.inputFile = valueOverTimeAggregatorInputFile - it.outputFile = "org/elasticsearch/compute/aggregation/${Occurrence}OverTimeIntAggregator.java" + it.inputFile = valueByTimestampAggregatorInputFile + it.outputFile = "org/elasticsearch/compute/aggregation/${Occurrence}IntByTimestampAggregator.java" } template { it.properties = addOccurrence(longProperties, Occurrence) - it.inputFile = valueOverTimeAggregatorInputFile - it.outputFile = "org/elasticsearch/compute/aggregation/${Occurrence}OverTimeLongAggregator.java" + it.inputFile = valueByTimestampAggregatorInputFile + it.outputFile = "org/elasticsearch/compute/aggregation/${Occurrence}LongByTimestampAggregator.java" } template { it.properties = addOccurrence(floatProperties, Occurrence) - it.inputFile = valueOverTimeAggregatorInputFile - it.outputFile = "org/elasticsearch/compute/aggregation/${Occurrence}OverTimeFloatAggregator.java" + it.inputFile = valueByTimestampAggregatorInputFile + it.outputFile = "org/elasticsearch/compute/aggregation/${Occurrence}FloatByTimestampAggregator.java" } template { it.properties = addOccurrence(doubleProperties, Occurrence) - it.inputFile = valueOverTimeAggregatorInputFile - it.outputFile = "org/elasticsearch/compute/aggregation/${Occurrence}OverTimeDoubleAggregator.java" + it.inputFile = valueByTimestampAggregatorInputFile + it.outputFile = "org/elasticsearch/compute/aggregation/${Occurrence}DoubleByTimestampAggregator.java" } } } diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/FirstOverTimeDoubleAggregator.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/FirstDoubleByTimestampAggregator.java similarity index 95% rename from x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/FirstOverTimeDoubleAggregator.java rename to x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/FirstDoubleByTimestampAggregator.java index 8f671ab21f130..a2b6650063b3d 100644 --- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/FirstOverTimeDoubleAggregator.java +++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/FirstDoubleByTimestampAggregator.java @@ -25,18 +25,16 @@ /** * A time-series aggregation function that collects the First occurrence value of a time series in a specified interval. - * This class is generated. Edit `X-ValueOverTimeAggregator.java.st` instead. + * This class is generated. Edit `X-ValueByTimestampAggregator.java.st` instead. */ @GroupingAggregator( { @IntermediateState(name = "timestamps", type = "LONG_BLOCK"), @IntermediateState(name = "values", type = "DOUBLE_BLOCK") } ) -public class FirstOverTimeDoubleAggregator { +public class FirstDoubleByTimestampAggregator { public static GroupingState initGrouping(DriverContext driverContext) { return new GroupingState(driverContext.bigArrays()); } - // TODO: Since data in data_streams is sorted by `_tsid` and timestamp in descending order, - // we can read the first encountered value for each group of `_tsid` and time bucket. public static void combine(GroupingState current, int groupId, double value, long timestamp) { current.collectValue(groupId, timestamp, value); } diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/FirstOverTimeFloatAggregator.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/FirstFloatByTimestampAggregator.java similarity index 95% rename from x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/FirstOverTimeFloatAggregator.java rename to x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/FirstFloatByTimestampAggregator.java index 83b1bbebca39e..77b6041c3395b 100644 --- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/FirstOverTimeFloatAggregator.java +++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/FirstFloatByTimestampAggregator.java @@ -25,18 +25,16 @@ /** * A time-series aggregation function that collects the First occurrence value of a time series in a specified interval. - * This class is generated. Edit `X-ValueOverTimeAggregator.java.st` instead. + * This class is generated. Edit `X-ValueByTimestampAggregator.java.st` instead. */ @GroupingAggregator( { @IntermediateState(name = "timestamps", type = "LONG_BLOCK"), @IntermediateState(name = "values", type = "FLOAT_BLOCK") } ) -public class FirstOverTimeFloatAggregator { +public class FirstFloatByTimestampAggregator { public static GroupingState initGrouping(DriverContext driverContext) { return new GroupingState(driverContext.bigArrays()); } - // TODO: Since data in data_streams is sorted by `_tsid` and timestamp in descending order, - // we can read the first encountered value for each group of `_tsid` and time bucket. public static void combine(GroupingState current, int groupId, float value, long timestamp) { current.collectValue(groupId, timestamp, value); } diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/FirstOverTimeIntAggregator.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/FirstIntByTimestampAggregator.java similarity index 95% rename from x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/FirstOverTimeIntAggregator.java rename to x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/FirstIntByTimestampAggregator.java index 994631d163120..0c463b27570a0 100644 --- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/FirstOverTimeIntAggregator.java +++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/FirstIntByTimestampAggregator.java @@ -25,18 +25,16 @@ /** * A time-series aggregation function that collects the First occurrence value of a time series in a specified interval. - * This class is generated. Edit `X-ValueOverTimeAggregator.java.st` instead. + * This class is generated. Edit `X-ValueByTimestampAggregator.java.st` instead. */ @GroupingAggregator( { @IntermediateState(name = "timestamps", type = "LONG_BLOCK"), @IntermediateState(name = "values", type = "INT_BLOCK") } ) -public class FirstOverTimeIntAggregator { +public class FirstIntByTimestampAggregator { public static GroupingState initGrouping(DriverContext driverContext) { return new GroupingState(driverContext.bigArrays()); } - // TODO: Since data in data_streams is sorted by `_tsid` and timestamp in descending order, - // we can read the first encountered value for each group of `_tsid` and time bucket. public static void combine(GroupingState current, int groupId, int value, long timestamp) { current.collectValue(groupId, timestamp, value); } diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/FirstOverTimeLongAggregator.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/FirstLongByTimestampAggregator.java similarity index 95% rename from x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/FirstOverTimeLongAggregator.java rename to x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/FirstLongByTimestampAggregator.java index 0155d633706af..b213bc0e5b1fa 100644 --- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/FirstOverTimeLongAggregator.java +++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/FirstLongByTimestampAggregator.java @@ -25,18 +25,16 @@ /** * A time-series aggregation function that collects the First occurrence value of a time series in a specified interval. - * This class is generated. Edit `X-ValueOverTimeAggregator.java.st` instead. + * This class is generated. Edit `X-ValueByTimestampAggregator.java.st` instead. */ @GroupingAggregator( { @IntermediateState(name = "timestamps", type = "LONG_BLOCK"), @IntermediateState(name = "values", type = "LONG_BLOCK") } ) -public class FirstOverTimeLongAggregator { +public class FirstLongByTimestampAggregator { public static GroupingState initGrouping(DriverContext driverContext) { return new GroupingState(driverContext.bigArrays()); } - // TODO: Since data in data_streams is sorted by `_tsid` and timestamp in descending order, - // we can read the first encountered value for each group of `_tsid` and time bucket. public static void combine(GroupingState current, int groupId, long value, long timestamp) { current.collectValue(groupId, timestamp, value); } diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/LastOverTimeDoubleAggregator.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/LastDoubleByTimestampAggregator.java similarity index 95% rename from x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/LastOverTimeDoubleAggregator.java rename to x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/LastDoubleByTimestampAggregator.java index d5c9fbae5dded..6bc04ec72f2b9 100644 --- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/LastOverTimeDoubleAggregator.java +++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/LastDoubleByTimestampAggregator.java @@ -25,18 +25,16 @@ /** * A time-series aggregation function that collects the Last occurrence value of a time series in a specified interval. - * This class is generated. Edit `X-ValueOverTimeAggregator.java.st` instead. + * This class is generated. Edit `X-ValueByTimestampAggregator.java.st` instead. */ @GroupingAggregator( { @IntermediateState(name = "timestamps", type = "LONG_BLOCK"), @IntermediateState(name = "values", type = "DOUBLE_BLOCK") } ) -public class LastOverTimeDoubleAggregator { +public class LastDoubleByTimestampAggregator { public static GroupingState initGrouping(DriverContext driverContext) { return new GroupingState(driverContext.bigArrays()); } - // TODO: Since data in data_streams is sorted by `_tsid` and timestamp in descending order, - // we can read the first encountered value for each group of `_tsid` and time bucket. public static void combine(GroupingState current, int groupId, double value, long timestamp) { current.collectValue(groupId, timestamp, value); } diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/LastOverTimeFloatAggregator.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/LastFloatByTimestampAggregator.java similarity index 95% rename from x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/LastOverTimeFloatAggregator.java rename to x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/LastFloatByTimestampAggregator.java index 63e5c55f7dc1c..9d997027c58da 100644 --- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/LastOverTimeFloatAggregator.java +++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/LastFloatByTimestampAggregator.java @@ -25,18 +25,16 @@ /** * A time-series aggregation function that collects the Last occurrence value of a time series in a specified interval. - * This class is generated. Edit `X-ValueOverTimeAggregator.java.st` instead. + * This class is generated. Edit `X-ValueByTimestampAggregator.java.st` instead. */ @GroupingAggregator( { @IntermediateState(name = "timestamps", type = "LONG_BLOCK"), @IntermediateState(name = "values", type = "FLOAT_BLOCK") } ) -public class LastOverTimeFloatAggregator { +public class LastFloatByTimestampAggregator { public static GroupingState initGrouping(DriverContext driverContext) { return new GroupingState(driverContext.bigArrays()); } - // TODO: Since data in data_streams is sorted by `_tsid` and timestamp in descending order, - // we can read the first encountered value for each group of `_tsid` and time bucket. public static void combine(GroupingState current, int groupId, float value, long timestamp) { current.collectValue(groupId, timestamp, value); } diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/LastOverTimeIntAggregator.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/LastIntByTimestampAggregator.java similarity index 95% rename from x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/LastOverTimeIntAggregator.java rename to x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/LastIntByTimestampAggregator.java index a4c7c48df6ec3..2549b26de5e40 100644 --- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/LastOverTimeIntAggregator.java +++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/LastIntByTimestampAggregator.java @@ -25,18 +25,16 @@ /** * A time-series aggregation function that collects the Last occurrence value of a time series in a specified interval. - * This class is generated. Edit `X-ValueOverTimeAggregator.java.st` instead. + * This class is generated. Edit `X-ValueByTimestampAggregator.java.st` instead. */ @GroupingAggregator( { @IntermediateState(name = "timestamps", type = "LONG_BLOCK"), @IntermediateState(name = "values", type = "INT_BLOCK") } ) -public class LastOverTimeIntAggregator { +public class LastIntByTimestampAggregator { public static GroupingState initGrouping(DriverContext driverContext) { return new GroupingState(driverContext.bigArrays()); } - // TODO: Since data in data_streams is sorted by `_tsid` and timestamp in descending order, - // we can read the first encountered value for each group of `_tsid` and time bucket. public static void combine(GroupingState current, int groupId, int value, long timestamp) { current.collectValue(groupId, timestamp, value); } diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/LastOverTimeLongAggregator.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/LastLongByTimestampAggregator.java similarity index 95% rename from x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/LastOverTimeLongAggregator.java rename to x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/LastLongByTimestampAggregator.java index 3a45d5f3f1c18..4288565f6b321 100644 --- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/LastOverTimeLongAggregator.java +++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/LastLongByTimestampAggregator.java @@ -25,18 +25,16 @@ /** * A time-series aggregation function that collects the Last occurrence value of a time series in a specified interval. - * This class is generated. Edit `X-ValueOverTimeAggregator.java.st` instead. + * This class is generated. Edit `X-ValueByTimestampAggregator.java.st` instead. */ @GroupingAggregator( { @IntermediateState(name = "timestamps", type = "LONG_BLOCK"), @IntermediateState(name = "values", type = "LONG_BLOCK") } ) -public class LastOverTimeLongAggregator { +public class LastLongByTimestampAggregator { public static GroupingState initGrouping(DriverContext driverContext) { return new GroupingState(driverContext.bigArrays()); } - // TODO: Since data in data_streams is sorted by `_tsid` and timestamp in descending order, - // we can read the first encountered value for each group of `_tsid` and time bucket. public static void combine(GroupingState current, int groupId, long value, long timestamp) { current.collectValue(groupId, timestamp, value); } diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstDoubleByTimestampAggregatorFunctionSupplier.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstDoubleByTimestampAggregatorFunctionSupplier.java new file mode 100644 index 0000000000000..6ece08cd3d5bd --- /dev/null +++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstDoubleByTimestampAggregatorFunctionSupplier.java @@ -0,0 +1,46 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License +// 2.0; you may not use this file except in compliance with the Elastic License +// 2.0. +package org.elasticsearch.compute.aggregation; + +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.util.List; +import org.elasticsearch.compute.operator.DriverContext; + +/** + * {@link AggregatorFunctionSupplier} implementation for {@link FirstDoubleByTimestampAggregator}. + * This class is generated. Edit {@code AggregatorFunctionSupplierImplementer} instead. + */ +public final class FirstDoubleByTimestampAggregatorFunctionSupplier implements AggregatorFunctionSupplier { + public FirstDoubleByTimestampAggregatorFunctionSupplier() { + } + + @Override + public List nonGroupingIntermediateStateDesc() { + throw new UnsupportedOperationException("non-grouping aggregator is not supported"); + } + + @Override + public List groupingIntermediateStateDesc() { + return FirstDoubleByTimestampGroupingAggregatorFunction.intermediateStateDesc(); + } + + @Override + public AggregatorFunction aggregator(DriverContext driverContext, List channels) { + throw new UnsupportedOperationException("non-grouping aggregator is not supported"); + } + + @Override + public FirstDoubleByTimestampGroupingAggregatorFunction groupingAggregator( + DriverContext driverContext, List channels) { + return FirstDoubleByTimestampGroupingAggregatorFunction.create(channels, driverContext); + } + + @Override + public String describe() { + return "first_double_by of timestamps"; + } +} diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastOverTimeDoubleGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstDoubleByTimestampGroupingAggregatorFunction.java similarity index 90% rename from x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastOverTimeDoubleGroupingAggregatorFunction.java rename to x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstDoubleByTimestampGroupingAggregatorFunction.java index 90c63e4feecb2..aa64e2e9517b5 100644 --- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastOverTimeDoubleGroupingAggregatorFunction.java +++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstDoubleByTimestampGroupingAggregatorFunction.java @@ -22,30 +22,30 @@ import org.elasticsearch.compute.operator.DriverContext; /** - * {@link GroupingAggregatorFunction} implementation for {@link LastOverTimeDoubleAggregator}. + * {@link GroupingAggregatorFunction} implementation for {@link FirstDoubleByTimestampAggregator}. * This class is generated. Edit {@code GroupingAggregatorImplementer} instead. */ -public final class LastOverTimeDoubleGroupingAggregatorFunction implements GroupingAggregatorFunction { +public final class FirstDoubleByTimestampGroupingAggregatorFunction implements GroupingAggregatorFunction { private static final List INTERMEDIATE_STATE_DESC = List.of( new IntermediateStateDesc("timestamps", ElementType.LONG), new IntermediateStateDesc("values", ElementType.DOUBLE) ); - private final LastOverTimeDoubleAggregator.GroupingState state; + private final FirstDoubleByTimestampAggregator.GroupingState state; private final List channels; private final DriverContext driverContext; - public LastOverTimeDoubleGroupingAggregatorFunction(List channels, - LastOverTimeDoubleAggregator.GroupingState state, DriverContext driverContext) { + public FirstDoubleByTimestampGroupingAggregatorFunction(List channels, + FirstDoubleByTimestampAggregator.GroupingState state, DriverContext driverContext) { this.channels = channels; this.state = state; this.driverContext = driverContext; } - public static LastOverTimeDoubleGroupingAggregatorFunction create(List channels, + public static FirstDoubleByTimestampGroupingAggregatorFunction create(List channels, DriverContext driverContext) { - return new LastOverTimeDoubleGroupingAggregatorFunction(channels, LastOverTimeDoubleAggregator.initGrouping(driverContext), driverContext); + return new FirstDoubleByTimestampGroupingAggregatorFunction(channels, FirstDoubleByTimestampAggregator.initGrouping(driverContext), driverContext); } public static List intermediateStateDesc() { @@ -161,7 +161,7 @@ private void addRawInput(int positionOffset, IntArrayBlock groups, DoubleBlock v int timestampEnd = timestampStart + timestampBlock.getValueCount(valuesPosition); for (int timestampOffset = timestampStart; timestampOffset < timestampEnd; timestampOffset++) { long timestampValue = timestampBlock.getLong(timestampOffset); - LastOverTimeDoubleAggregator.combine(state, groupId, valueValue, timestampValue); + FirstDoubleByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } } @@ -181,7 +181,7 @@ private void addRawInput(int positionOffset, IntArrayBlock groups, DoubleVector int groupId = groups.getInt(g); double valueValue = valueVector.getDouble(valuesPosition); long timestampValue = timestampVector.getLong(valuesPosition); - LastOverTimeDoubleAggregator.combine(state, groupId, valueValue, timestampValue); + FirstDoubleByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } } @@ -210,7 +210,7 @@ public void addIntermediateInput(int positionOffset, IntArrayBlock groups, Page for (int g = groupStart; g < groupEnd; g++) { int groupId = groups.getInt(g); int valuesPosition = groupPosition + positionOffset; - LastOverTimeDoubleAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); + FirstDoubleByTimestampAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); } } } @@ -240,7 +240,7 @@ private void addRawInput(int positionOffset, IntBigArrayBlock groups, DoubleBloc int timestampEnd = timestampStart + timestampBlock.getValueCount(valuesPosition); for (int timestampOffset = timestampStart; timestampOffset < timestampEnd; timestampOffset++) { long timestampValue = timestampBlock.getLong(timestampOffset); - LastOverTimeDoubleAggregator.combine(state, groupId, valueValue, timestampValue); + FirstDoubleByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } } @@ -260,7 +260,7 @@ private void addRawInput(int positionOffset, IntBigArrayBlock groups, DoubleVect int groupId = groups.getInt(g); double valueValue = valueVector.getDouble(valuesPosition); long timestampValue = timestampVector.getLong(valuesPosition); - LastOverTimeDoubleAggregator.combine(state, groupId, valueValue, timestampValue); + FirstDoubleByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } } @@ -289,7 +289,7 @@ public void addIntermediateInput(int positionOffset, IntBigArrayBlock groups, Pa for (int g = groupStart; g < groupEnd; g++) { int groupId = groups.getInt(g); int valuesPosition = groupPosition + positionOffset; - LastOverTimeDoubleAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); + FirstDoubleByTimestampAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); } } } @@ -313,7 +313,7 @@ private void addRawInput(int positionOffset, IntVector groups, DoubleBlock value int timestampEnd = timestampStart + timestampBlock.getValueCount(valuesPosition); for (int timestampOffset = timestampStart; timestampOffset < timestampEnd; timestampOffset++) { long timestampValue = timestampBlock.getLong(timestampOffset); - LastOverTimeDoubleAggregator.combine(state, groupId, valueValue, timestampValue); + FirstDoubleByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } } @@ -326,7 +326,7 @@ private void addRawInput(int positionOffset, IntVector groups, DoubleVector valu int groupId = groups.getInt(groupPosition); double valueValue = valueVector.getDouble(valuesPosition); long timestampValue = timestampVector.getLong(valuesPosition); - LastOverTimeDoubleAggregator.combine(state, groupId, valueValue, timestampValue); + FirstDoubleByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } @@ -348,7 +348,7 @@ public void addIntermediateInput(int positionOffset, IntVector groups, Page page for (int groupPosition = 0; groupPosition < groups.getPositionCount(); groupPosition++) { int groupId = groups.getInt(groupPosition); int valuesPosition = groupPosition + positionOffset; - LastOverTimeDoubleAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); + FirstDoubleByTimestampAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); } } @@ -365,7 +365,7 @@ public void evaluateIntermediate(Block[] blocks, int offset, IntVector selected) @Override public void evaluateFinal(Block[] blocks, int offset, IntVector selected, GroupingAggregatorEvaluationContext ctx) { - blocks[offset] = LastOverTimeDoubleAggregator.evaluateFinal(state, selected, ctx); + blocks[offset] = FirstDoubleByTimestampAggregator.evaluateFinal(state, selected, ctx); } @Override diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstFloatByTimestampAggregatorFunctionSupplier.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstFloatByTimestampAggregatorFunctionSupplier.java new file mode 100644 index 0000000000000..046e3a5c09099 --- /dev/null +++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstFloatByTimestampAggregatorFunctionSupplier.java @@ -0,0 +1,46 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License +// 2.0; you may not use this file except in compliance with the Elastic License +// 2.0. +package org.elasticsearch.compute.aggregation; + +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.util.List; +import org.elasticsearch.compute.operator.DriverContext; + +/** + * {@link AggregatorFunctionSupplier} implementation for {@link FirstFloatByTimestampAggregator}. + * This class is generated. Edit {@code AggregatorFunctionSupplierImplementer} instead. + */ +public final class FirstFloatByTimestampAggregatorFunctionSupplier implements AggregatorFunctionSupplier { + public FirstFloatByTimestampAggregatorFunctionSupplier() { + } + + @Override + public List nonGroupingIntermediateStateDesc() { + throw new UnsupportedOperationException("non-grouping aggregator is not supported"); + } + + @Override + public List groupingIntermediateStateDesc() { + return FirstFloatByTimestampGroupingAggregatorFunction.intermediateStateDesc(); + } + + @Override + public AggregatorFunction aggregator(DriverContext driverContext, List channels) { + throw new UnsupportedOperationException("non-grouping aggregator is not supported"); + } + + @Override + public FirstFloatByTimestampGroupingAggregatorFunction groupingAggregator( + DriverContext driverContext, List channels) { + return FirstFloatByTimestampGroupingAggregatorFunction.create(channels, driverContext); + } + + @Override + public String describe() { + return "first_float_by of timestamps"; + } +} diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastOverTimeFloatGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstFloatByTimestampGroupingAggregatorFunction.java similarity index 90% rename from x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastOverTimeFloatGroupingAggregatorFunction.java rename to x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstFloatByTimestampGroupingAggregatorFunction.java index 0a5a2ec97fe48..e9780107df1c3 100644 --- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastOverTimeFloatGroupingAggregatorFunction.java +++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstFloatByTimestampGroupingAggregatorFunction.java @@ -22,30 +22,30 @@ import org.elasticsearch.compute.operator.DriverContext; /** - * {@link GroupingAggregatorFunction} implementation for {@link LastOverTimeFloatAggregator}. + * {@link GroupingAggregatorFunction} implementation for {@link FirstFloatByTimestampAggregator}. * This class is generated. Edit {@code GroupingAggregatorImplementer} instead. */ -public final class LastOverTimeFloatGroupingAggregatorFunction implements GroupingAggregatorFunction { +public final class FirstFloatByTimestampGroupingAggregatorFunction implements GroupingAggregatorFunction { private static final List INTERMEDIATE_STATE_DESC = List.of( new IntermediateStateDesc("timestamps", ElementType.LONG), new IntermediateStateDesc("values", ElementType.FLOAT) ); - private final LastOverTimeFloatAggregator.GroupingState state; + private final FirstFloatByTimestampAggregator.GroupingState state; private final List channels; private final DriverContext driverContext; - public LastOverTimeFloatGroupingAggregatorFunction(List channels, - LastOverTimeFloatAggregator.GroupingState state, DriverContext driverContext) { + public FirstFloatByTimestampGroupingAggregatorFunction(List channels, + FirstFloatByTimestampAggregator.GroupingState state, DriverContext driverContext) { this.channels = channels; this.state = state; this.driverContext = driverContext; } - public static LastOverTimeFloatGroupingAggregatorFunction create(List channels, + public static FirstFloatByTimestampGroupingAggregatorFunction create(List channels, DriverContext driverContext) { - return new LastOverTimeFloatGroupingAggregatorFunction(channels, LastOverTimeFloatAggregator.initGrouping(driverContext), driverContext); + return new FirstFloatByTimestampGroupingAggregatorFunction(channels, FirstFloatByTimestampAggregator.initGrouping(driverContext), driverContext); } public static List intermediateStateDesc() { @@ -161,7 +161,7 @@ private void addRawInput(int positionOffset, IntArrayBlock groups, FloatBlock va int timestampEnd = timestampStart + timestampBlock.getValueCount(valuesPosition); for (int timestampOffset = timestampStart; timestampOffset < timestampEnd; timestampOffset++) { long timestampValue = timestampBlock.getLong(timestampOffset); - LastOverTimeFloatAggregator.combine(state, groupId, valueValue, timestampValue); + FirstFloatByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } } @@ -181,7 +181,7 @@ private void addRawInput(int positionOffset, IntArrayBlock groups, FloatVector v int groupId = groups.getInt(g); float valueValue = valueVector.getFloat(valuesPosition); long timestampValue = timestampVector.getLong(valuesPosition); - LastOverTimeFloatAggregator.combine(state, groupId, valueValue, timestampValue); + FirstFloatByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } } @@ -210,7 +210,7 @@ public void addIntermediateInput(int positionOffset, IntArrayBlock groups, Page for (int g = groupStart; g < groupEnd; g++) { int groupId = groups.getInt(g); int valuesPosition = groupPosition + positionOffset; - LastOverTimeFloatAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); + FirstFloatByTimestampAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); } } } @@ -240,7 +240,7 @@ private void addRawInput(int positionOffset, IntBigArrayBlock groups, FloatBlock int timestampEnd = timestampStart + timestampBlock.getValueCount(valuesPosition); for (int timestampOffset = timestampStart; timestampOffset < timestampEnd; timestampOffset++) { long timestampValue = timestampBlock.getLong(timestampOffset); - LastOverTimeFloatAggregator.combine(state, groupId, valueValue, timestampValue); + FirstFloatByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } } @@ -260,7 +260,7 @@ private void addRawInput(int positionOffset, IntBigArrayBlock groups, FloatVecto int groupId = groups.getInt(g); float valueValue = valueVector.getFloat(valuesPosition); long timestampValue = timestampVector.getLong(valuesPosition); - LastOverTimeFloatAggregator.combine(state, groupId, valueValue, timestampValue); + FirstFloatByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } } @@ -289,7 +289,7 @@ public void addIntermediateInput(int positionOffset, IntBigArrayBlock groups, Pa for (int g = groupStart; g < groupEnd; g++) { int groupId = groups.getInt(g); int valuesPosition = groupPosition + positionOffset; - LastOverTimeFloatAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); + FirstFloatByTimestampAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); } } } @@ -313,7 +313,7 @@ private void addRawInput(int positionOffset, IntVector groups, FloatBlock valueB int timestampEnd = timestampStart + timestampBlock.getValueCount(valuesPosition); for (int timestampOffset = timestampStart; timestampOffset < timestampEnd; timestampOffset++) { long timestampValue = timestampBlock.getLong(timestampOffset); - LastOverTimeFloatAggregator.combine(state, groupId, valueValue, timestampValue); + FirstFloatByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } } @@ -326,7 +326,7 @@ private void addRawInput(int positionOffset, IntVector groups, FloatVector value int groupId = groups.getInt(groupPosition); float valueValue = valueVector.getFloat(valuesPosition); long timestampValue = timestampVector.getLong(valuesPosition); - LastOverTimeFloatAggregator.combine(state, groupId, valueValue, timestampValue); + FirstFloatByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } @@ -348,7 +348,7 @@ public void addIntermediateInput(int positionOffset, IntVector groups, Page page for (int groupPosition = 0; groupPosition < groups.getPositionCount(); groupPosition++) { int groupId = groups.getInt(groupPosition); int valuesPosition = groupPosition + positionOffset; - LastOverTimeFloatAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); + FirstFloatByTimestampAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); } } @@ -365,7 +365,7 @@ public void evaluateIntermediate(Block[] blocks, int offset, IntVector selected) @Override public void evaluateFinal(Block[] blocks, int offset, IntVector selected, GroupingAggregatorEvaluationContext ctx) { - blocks[offset] = LastOverTimeFloatAggregator.evaluateFinal(state, selected, ctx); + blocks[offset] = FirstFloatByTimestampAggregator.evaluateFinal(state, selected, ctx); } @Override diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstOverTimeDoubleAggregatorFunctionSupplier.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstIntByTimestampAggregatorFunctionSupplier.java similarity index 77% rename from x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstOverTimeDoubleAggregatorFunctionSupplier.java rename to x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstIntByTimestampAggregatorFunctionSupplier.java index 3a144f0789efb..eeddcf2684324 100644 --- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstOverTimeDoubleAggregatorFunctionSupplier.java +++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstIntByTimestampAggregatorFunctionSupplier.java @@ -11,11 +11,11 @@ import org.elasticsearch.compute.operator.DriverContext; /** - * {@link AggregatorFunctionSupplier} implementation for {@link FirstOverTimeDoubleAggregator}. + * {@link AggregatorFunctionSupplier} implementation for {@link FirstIntByTimestampAggregator}. * This class is generated. Edit {@code AggregatorFunctionSupplierImplementer} instead. */ -public final class FirstOverTimeDoubleAggregatorFunctionSupplier implements AggregatorFunctionSupplier { - public FirstOverTimeDoubleAggregatorFunctionSupplier() { +public final class FirstIntByTimestampAggregatorFunctionSupplier implements AggregatorFunctionSupplier { + public FirstIntByTimestampAggregatorFunctionSupplier() { } @Override @@ -25,7 +25,7 @@ public List nonGroupingIntermediateStateDesc() { @Override public List groupingIntermediateStateDesc() { - return FirstOverTimeDoubleGroupingAggregatorFunction.intermediateStateDesc(); + return FirstIntByTimestampGroupingAggregatorFunction.intermediateStateDesc(); } @Override @@ -34,13 +34,13 @@ public AggregatorFunction aggregator(DriverContext driverContext, List } @Override - public FirstOverTimeDoubleGroupingAggregatorFunction groupingAggregator( + public FirstIntByTimestampGroupingAggregatorFunction groupingAggregator( DriverContext driverContext, List channels) { - return FirstOverTimeDoubleGroupingAggregatorFunction.create(channels, driverContext); + return FirstIntByTimestampGroupingAggregatorFunction.create(channels, driverContext); } @Override public String describe() { - return "first_over_time of doubles"; + return "first_int_by of timestamps"; } } diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastOverTimeIntGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstIntByTimestampGroupingAggregatorFunction.java similarity index 90% rename from x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastOverTimeIntGroupingAggregatorFunction.java rename to x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstIntByTimestampGroupingAggregatorFunction.java index def90f4f1885f..f90867dcb2471 100644 --- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastOverTimeIntGroupingAggregatorFunction.java +++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstIntByTimestampGroupingAggregatorFunction.java @@ -21,30 +21,30 @@ import org.elasticsearch.compute.operator.DriverContext; /** - * {@link GroupingAggregatorFunction} implementation for {@link LastOverTimeIntAggregator}. + * {@link GroupingAggregatorFunction} implementation for {@link FirstIntByTimestampAggregator}. * This class is generated. Edit {@code GroupingAggregatorImplementer} instead. */ -public final class LastOverTimeIntGroupingAggregatorFunction implements GroupingAggregatorFunction { +public final class FirstIntByTimestampGroupingAggregatorFunction implements GroupingAggregatorFunction { private static final List INTERMEDIATE_STATE_DESC = List.of( new IntermediateStateDesc("timestamps", ElementType.LONG), new IntermediateStateDesc("values", ElementType.INT) ); - private final LastOverTimeIntAggregator.GroupingState state; + private final FirstIntByTimestampAggregator.GroupingState state; private final List channels; private final DriverContext driverContext; - public LastOverTimeIntGroupingAggregatorFunction(List channels, - LastOverTimeIntAggregator.GroupingState state, DriverContext driverContext) { + public FirstIntByTimestampGroupingAggregatorFunction(List channels, + FirstIntByTimestampAggregator.GroupingState state, DriverContext driverContext) { this.channels = channels; this.state = state; this.driverContext = driverContext; } - public static LastOverTimeIntGroupingAggregatorFunction create(List channels, + public static FirstIntByTimestampGroupingAggregatorFunction create(List channels, DriverContext driverContext) { - return new LastOverTimeIntGroupingAggregatorFunction(channels, LastOverTimeIntAggregator.initGrouping(driverContext), driverContext); + return new FirstIntByTimestampGroupingAggregatorFunction(channels, FirstIntByTimestampAggregator.initGrouping(driverContext), driverContext); } public static List intermediateStateDesc() { @@ -160,7 +160,7 @@ private void addRawInput(int positionOffset, IntArrayBlock groups, IntBlock valu int timestampEnd = timestampStart + timestampBlock.getValueCount(valuesPosition); for (int timestampOffset = timestampStart; timestampOffset < timestampEnd; timestampOffset++) { long timestampValue = timestampBlock.getLong(timestampOffset); - LastOverTimeIntAggregator.combine(state, groupId, valueValue, timestampValue); + FirstIntByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } } @@ -180,7 +180,7 @@ private void addRawInput(int positionOffset, IntArrayBlock groups, IntVector val int groupId = groups.getInt(g); int valueValue = valueVector.getInt(valuesPosition); long timestampValue = timestampVector.getLong(valuesPosition); - LastOverTimeIntAggregator.combine(state, groupId, valueValue, timestampValue); + FirstIntByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } } @@ -209,7 +209,7 @@ public void addIntermediateInput(int positionOffset, IntArrayBlock groups, Page for (int g = groupStart; g < groupEnd; g++) { int groupId = groups.getInt(g); int valuesPosition = groupPosition + positionOffset; - LastOverTimeIntAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); + FirstIntByTimestampAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); } } } @@ -239,7 +239,7 @@ private void addRawInput(int positionOffset, IntBigArrayBlock groups, IntBlock v int timestampEnd = timestampStart + timestampBlock.getValueCount(valuesPosition); for (int timestampOffset = timestampStart; timestampOffset < timestampEnd; timestampOffset++) { long timestampValue = timestampBlock.getLong(timestampOffset); - LastOverTimeIntAggregator.combine(state, groupId, valueValue, timestampValue); + FirstIntByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } } @@ -259,7 +259,7 @@ private void addRawInput(int positionOffset, IntBigArrayBlock groups, IntVector int groupId = groups.getInt(g); int valueValue = valueVector.getInt(valuesPosition); long timestampValue = timestampVector.getLong(valuesPosition); - LastOverTimeIntAggregator.combine(state, groupId, valueValue, timestampValue); + FirstIntByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } } @@ -288,7 +288,7 @@ public void addIntermediateInput(int positionOffset, IntBigArrayBlock groups, Pa for (int g = groupStart; g < groupEnd; g++) { int groupId = groups.getInt(g); int valuesPosition = groupPosition + positionOffset; - LastOverTimeIntAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); + FirstIntByTimestampAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); } } } @@ -312,7 +312,7 @@ private void addRawInput(int positionOffset, IntVector groups, IntBlock valueBlo int timestampEnd = timestampStart + timestampBlock.getValueCount(valuesPosition); for (int timestampOffset = timestampStart; timestampOffset < timestampEnd; timestampOffset++) { long timestampValue = timestampBlock.getLong(timestampOffset); - LastOverTimeIntAggregator.combine(state, groupId, valueValue, timestampValue); + FirstIntByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } } @@ -325,7 +325,7 @@ private void addRawInput(int positionOffset, IntVector groups, IntVector valueVe int groupId = groups.getInt(groupPosition); int valueValue = valueVector.getInt(valuesPosition); long timestampValue = timestampVector.getLong(valuesPosition); - LastOverTimeIntAggregator.combine(state, groupId, valueValue, timestampValue); + FirstIntByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } @@ -347,7 +347,7 @@ public void addIntermediateInput(int positionOffset, IntVector groups, Page page for (int groupPosition = 0; groupPosition < groups.getPositionCount(); groupPosition++) { int groupId = groups.getInt(groupPosition); int valuesPosition = groupPosition + positionOffset; - LastOverTimeIntAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); + FirstIntByTimestampAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); } } @@ -364,7 +364,7 @@ public void evaluateIntermediate(Block[] blocks, int offset, IntVector selected) @Override public void evaluateFinal(Block[] blocks, int offset, IntVector selected, GroupingAggregatorEvaluationContext ctx) { - blocks[offset] = LastOverTimeIntAggregator.evaluateFinal(state, selected, ctx); + blocks[offset] = FirstIntByTimestampAggregator.evaluateFinal(state, selected, ctx); } @Override diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstOverTimeLongAggregatorFunctionSupplier.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstLongByTimestampAggregatorFunctionSupplier.java similarity index 67% rename from x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstOverTimeLongAggregatorFunctionSupplier.java rename to x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstLongByTimestampAggregatorFunctionSupplier.java index d07c29df61e9b..9cc7f1f680ab9 100644 --- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstOverTimeLongAggregatorFunctionSupplier.java +++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstLongByTimestampAggregatorFunctionSupplier.java @@ -11,11 +11,11 @@ import org.elasticsearch.compute.operator.DriverContext; /** - * {@link AggregatorFunctionSupplier} implementation for {@link FirstOverTimeLongAggregator}. + * {@link AggregatorFunctionSupplier} implementation for {@link FirstLongByTimestampAggregator}. * This class is generated. Edit {@code AggregatorFunctionSupplierImplementer} instead. */ -public final class FirstOverTimeLongAggregatorFunctionSupplier implements AggregatorFunctionSupplier { - public FirstOverTimeLongAggregatorFunctionSupplier() { +public final class FirstLongByTimestampAggregatorFunctionSupplier implements AggregatorFunctionSupplier { + public FirstLongByTimestampAggregatorFunctionSupplier() { } @Override @@ -25,7 +25,7 @@ public List nonGroupingIntermediateStateDesc() { @Override public List groupingIntermediateStateDesc() { - return FirstOverTimeLongGroupingAggregatorFunction.intermediateStateDesc(); + return FirstLongByTimestampGroupingAggregatorFunction.intermediateStateDesc(); } @Override @@ -34,13 +34,13 @@ public AggregatorFunction aggregator(DriverContext driverContext, List } @Override - public FirstOverTimeLongGroupingAggregatorFunction groupingAggregator(DriverContext driverContext, - List channels) { - return FirstOverTimeLongGroupingAggregatorFunction.create(channels, driverContext); + public FirstLongByTimestampGroupingAggregatorFunction groupingAggregator( + DriverContext driverContext, List channels) { + return FirstLongByTimestampGroupingAggregatorFunction.create(channels, driverContext); } @Override public String describe() { - return "first_over_time of longs"; + return "first_long_by of timestamps"; } } diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastOverTimeLongGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstLongByTimestampGroupingAggregatorFunction.java similarity index 90% rename from x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastOverTimeLongGroupingAggregatorFunction.java rename to x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstLongByTimestampGroupingAggregatorFunction.java index 918009cd8619f..a76a2d644fbff 100644 --- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastOverTimeLongGroupingAggregatorFunction.java +++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstLongByTimestampGroupingAggregatorFunction.java @@ -20,30 +20,30 @@ import org.elasticsearch.compute.operator.DriverContext; /** - * {@link GroupingAggregatorFunction} implementation for {@link LastOverTimeLongAggregator}. + * {@link GroupingAggregatorFunction} implementation for {@link FirstLongByTimestampAggregator}. * This class is generated. Edit {@code GroupingAggregatorImplementer} instead. */ -public final class LastOverTimeLongGroupingAggregatorFunction implements GroupingAggregatorFunction { +public final class FirstLongByTimestampGroupingAggregatorFunction implements GroupingAggregatorFunction { private static final List INTERMEDIATE_STATE_DESC = List.of( new IntermediateStateDesc("timestamps", ElementType.LONG), new IntermediateStateDesc("values", ElementType.LONG) ); - private final LastOverTimeLongAggregator.GroupingState state; + private final FirstLongByTimestampAggregator.GroupingState state; private final List channels; private final DriverContext driverContext; - public LastOverTimeLongGroupingAggregatorFunction(List channels, - LastOverTimeLongAggregator.GroupingState state, DriverContext driverContext) { + public FirstLongByTimestampGroupingAggregatorFunction(List channels, + FirstLongByTimestampAggregator.GroupingState state, DriverContext driverContext) { this.channels = channels; this.state = state; this.driverContext = driverContext; } - public static LastOverTimeLongGroupingAggregatorFunction create(List channels, + public static FirstLongByTimestampGroupingAggregatorFunction create(List channels, DriverContext driverContext) { - return new LastOverTimeLongGroupingAggregatorFunction(channels, LastOverTimeLongAggregator.initGrouping(driverContext), driverContext); + return new FirstLongByTimestampGroupingAggregatorFunction(channels, FirstLongByTimestampAggregator.initGrouping(driverContext), driverContext); } public static List intermediateStateDesc() { @@ -159,7 +159,7 @@ private void addRawInput(int positionOffset, IntArrayBlock groups, LongBlock val int timestampEnd = timestampStart + timestampBlock.getValueCount(valuesPosition); for (int timestampOffset = timestampStart; timestampOffset < timestampEnd; timestampOffset++) { long timestampValue = timestampBlock.getLong(timestampOffset); - LastOverTimeLongAggregator.combine(state, groupId, valueValue, timestampValue); + FirstLongByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } } @@ -179,7 +179,7 @@ private void addRawInput(int positionOffset, IntArrayBlock groups, LongVector va int groupId = groups.getInt(g); long valueValue = valueVector.getLong(valuesPosition); long timestampValue = timestampVector.getLong(valuesPosition); - LastOverTimeLongAggregator.combine(state, groupId, valueValue, timestampValue); + FirstLongByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } } @@ -208,7 +208,7 @@ public void addIntermediateInput(int positionOffset, IntArrayBlock groups, Page for (int g = groupStart; g < groupEnd; g++) { int groupId = groups.getInt(g); int valuesPosition = groupPosition + positionOffset; - LastOverTimeLongAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); + FirstLongByTimestampAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); } } } @@ -238,7 +238,7 @@ private void addRawInput(int positionOffset, IntBigArrayBlock groups, LongBlock int timestampEnd = timestampStart + timestampBlock.getValueCount(valuesPosition); for (int timestampOffset = timestampStart; timestampOffset < timestampEnd; timestampOffset++) { long timestampValue = timestampBlock.getLong(timestampOffset); - LastOverTimeLongAggregator.combine(state, groupId, valueValue, timestampValue); + FirstLongByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } } @@ -258,7 +258,7 @@ private void addRawInput(int positionOffset, IntBigArrayBlock groups, LongVector int groupId = groups.getInt(g); long valueValue = valueVector.getLong(valuesPosition); long timestampValue = timestampVector.getLong(valuesPosition); - LastOverTimeLongAggregator.combine(state, groupId, valueValue, timestampValue); + FirstLongByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } } @@ -287,7 +287,7 @@ public void addIntermediateInput(int positionOffset, IntBigArrayBlock groups, Pa for (int g = groupStart; g < groupEnd; g++) { int groupId = groups.getInt(g); int valuesPosition = groupPosition + positionOffset; - LastOverTimeLongAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); + FirstLongByTimestampAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); } } } @@ -311,7 +311,7 @@ private void addRawInput(int positionOffset, IntVector groups, LongBlock valueBl int timestampEnd = timestampStart + timestampBlock.getValueCount(valuesPosition); for (int timestampOffset = timestampStart; timestampOffset < timestampEnd; timestampOffset++) { long timestampValue = timestampBlock.getLong(timestampOffset); - LastOverTimeLongAggregator.combine(state, groupId, valueValue, timestampValue); + FirstLongByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } } @@ -324,7 +324,7 @@ private void addRawInput(int positionOffset, IntVector groups, LongVector valueV int groupId = groups.getInt(groupPosition); long valueValue = valueVector.getLong(valuesPosition); long timestampValue = timestampVector.getLong(valuesPosition); - LastOverTimeLongAggregator.combine(state, groupId, valueValue, timestampValue); + FirstLongByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } @@ -346,7 +346,7 @@ public void addIntermediateInput(int positionOffset, IntVector groups, Page page for (int groupPosition = 0; groupPosition < groups.getPositionCount(); groupPosition++) { int groupId = groups.getInt(groupPosition); int valuesPosition = groupPosition + positionOffset; - LastOverTimeLongAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); + FirstLongByTimestampAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); } } @@ -363,7 +363,7 @@ public void evaluateIntermediate(Block[] blocks, int offset, IntVector selected) @Override public void evaluateFinal(Block[] blocks, int offset, IntVector selected, GroupingAggregatorEvaluationContext ctx) { - blocks[offset] = LastOverTimeLongAggregator.evaluateFinal(state, selected, ctx); + blocks[offset] = FirstLongByTimestampAggregator.evaluateFinal(state, selected, ctx); } @Override diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstOverTimeIntAggregatorFunctionSupplier.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstOverTimeIntAggregatorFunctionSupplier.java deleted file mode 100644 index 5074c719e2f0f..0000000000000 --- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstOverTimeIntAggregatorFunctionSupplier.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one -// or more contributor license agreements. Licensed under the Elastic License -// 2.0; you may not use this file except in compliance with the Elastic License -// 2.0. -package org.elasticsearch.compute.aggregation; - -import java.lang.Integer; -import java.lang.Override; -import java.lang.String; -import java.util.List; -import org.elasticsearch.compute.operator.DriverContext; - -/** - * {@link AggregatorFunctionSupplier} implementation for {@link FirstOverTimeIntAggregator}. - * This class is generated. Edit {@code AggregatorFunctionSupplierImplementer} instead. - */ -public final class FirstOverTimeIntAggregatorFunctionSupplier implements AggregatorFunctionSupplier { - public FirstOverTimeIntAggregatorFunctionSupplier() { - } - - @Override - public List nonGroupingIntermediateStateDesc() { - throw new UnsupportedOperationException("non-grouping aggregator is not supported"); - } - - @Override - public List groupingIntermediateStateDesc() { - return FirstOverTimeIntGroupingAggregatorFunction.intermediateStateDesc(); - } - - @Override - public AggregatorFunction aggregator(DriverContext driverContext, List channels) { - throw new UnsupportedOperationException("non-grouping aggregator is not supported"); - } - - @Override - public FirstOverTimeIntGroupingAggregatorFunction groupingAggregator(DriverContext driverContext, - List channels) { - return FirstOverTimeIntGroupingAggregatorFunction.create(channels, driverContext); - } - - @Override - public String describe() { - return "first_over_time of ints"; - } -} diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastDoubleByTimestampAggregatorFunctionSupplier.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastDoubleByTimestampAggregatorFunctionSupplier.java new file mode 100644 index 0000000000000..c0e9aa344791c --- /dev/null +++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastDoubleByTimestampAggregatorFunctionSupplier.java @@ -0,0 +1,46 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License +// 2.0; you may not use this file except in compliance with the Elastic License +// 2.0. +package org.elasticsearch.compute.aggregation; + +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.util.List; +import org.elasticsearch.compute.operator.DriverContext; + +/** + * {@link AggregatorFunctionSupplier} implementation for {@link LastDoubleByTimestampAggregator}. + * This class is generated. Edit {@code AggregatorFunctionSupplierImplementer} instead. + */ +public final class LastDoubleByTimestampAggregatorFunctionSupplier implements AggregatorFunctionSupplier { + public LastDoubleByTimestampAggregatorFunctionSupplier() { + } + + @Override + public List nonGroupingIntermediateStateDesc() { + throw new UnsupportedOperationException("non-grouping aggregator is not supported"); + } + + @Override + public List groupingIntermediateStateDesc() { + return LastDoubleByTimestampGroupingAggregatorFunction.intermediateStateDesc(); + } + + @Override + public AggregatorFunction aggregator(DriverContext driverContext, List channels) { + throw new UnsupportedOperationException("non-grouping aggregator is not supported"); + } + + @Override + public LastDoubleByTimestampGroupingAggregatorFunction groupingAggregator( + DriverContext driverContext, List channels) { + return LastDoubleByTimestampGroupingAggregatorFunction.create(channels, driverContext); + } + + @Override + public String describe() { + return "last_double_by of timestamps"; + } +} diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstOverTimeDoubleGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastDoubleByTimestampGroupingAggregatorFunction.java similarity index 90% rename from x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstOverTimeDoubleGroupingAggregatorFunction.java rename to x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastDoubleByTimestampGroupingAggregatorFunction.java index 8513042de93ec..3bdc95c494421 100644 --- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstOverTimeDoubleGroupingAggregatorFunction.java +++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastDoubleByTimestampGroupingAggregatorFunction.java @@ -22,30 +22,30 @@ import org.elasticsearch.compute.operator.DriverContext; /** - * {@link GroupingAggregatorFunction} implementation for {@link FirstOverTimeDoubleAggregator}. + * {@link GroupingAggregatorFunction} implementation for {@link LastDoubleByTimestampAggregator}. * This class is generated. Edit {@code GroupingAggregatorImplementer} instead. */ -public final class FirstOverTimeDoubleGroupingAggregatorFunction implements GroupingAggregatorFunction { +public final class LastDoubleByTimestampGroupingAggregatorFunction implements GroupingAggregatorFunction { private static final List INTERMEDIATE_STATE_DESC = List.of( new IntermediateStateDesc("timestamps", ElementType.LONG), new IntermediateStateDesc("values", ElementType.DOUBLE) ); - private final FirstOverTimeDoubleAggregator.GroupingState state; + private final LastDoubleByTimestampAggregator.GroupingState state; private final List channels; private final DriverContext driverContext; - public FirstOverTimeDoubleGroupingAggregatorFunction(List channels, - FirstOverTimeDoubleAggregator.GroupingState state, DriverContext driverContext) { + public LastDoubleByTimestampGroupingAggregatorFunction(List channels, + LastDoubleByTimestampAggregator.GroupingState state, DriverContext driverContext) { this.channels = channels; this.state = state; this.driverContext = driverContext; } - public static FirstOverTimeDoubleGroupingAggregatorFunction create(List channels, + public static LastDoubleByTimestampGroupingAggregatorFunction create(List channels, DriverContext driverContext) { - return new FirstOverTimeDoubleGroupingAggregatorFunction(channels, FirstOverTimeDoubleAggregator.initGrouping(driverContext), driverContext); + return new LastDoubleByTimestampGroupingAggregatorFunction(channels, LastDoubleByTimestampAggregator.initGrouping(driverContext), driverContext); } public static List intermediateStateDesc() { @@ -161,7 +161,7 @@ private void addRawInput(int positionOffset, IntArrayBlock groups, DoubleBlock v int timestampEnd = timestampStart + timestampBlock.getValueCount(valuesPosition); for (int timestampOffset = timestampStart; timestampOffset < timestampEnd; timestampOffset++) { long timestampValue = timestampBlock.getLong(timestampOffset); - FirstOverTimeDoubleAggregator.combine(state, groupId, valueValue, timestampValue); + LastDoubleByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } } @@ -181,7 +181,7 @@ private void addRawInput(int positionOffset, IntArrayBlock groups, DoubleVector int groupId = groups.getInt(g); double valueValue = valueVector.getDouble(valuesPosition); long timestampValue = timestampVector.getLong(valuesPosition); - FirstOverTimeDoubleAggregator.combine(state, groupId, valueValue, timestampValue); + LastDoubleByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } } @@ -210,7 +210,7 @@ public void addIntermediateInput(int positionOffset, IntArrayBlock groups, Page for (int g = groupStart; g < groupEnd; g++) { int groupId = groups.getInt(g); int valuesPosition = groupPosition + positionOffset; - FirstOverTimeDoubleAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); + LastDoubleByTimestampAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); } } } @@ -240,7 +240,7 @@ private void addRawInput(int positionOffset, IntBigArrayBlock groups, DoubleBloc int timestampEnd = timestampStart + timestampBlock.getValueCount(valuesPosition); for (int timestampOffset = timestampStart; timestampOffset < timestampEnd; timestampOffset++) { long timestampValue = timestampBlock.getLong(timestampOffset); - FirstOverTimeDoubleAggregator.combine(state, groupId, valueValue, timestampValue); + LastDoubleByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } } @@ -260,7 +260,7 @@ private void addRawInput(int positionOffset, IntBigArrayBlock groups, DoubleVect int groupId = groups.getInt(g); double valueValue = valueVector.getDouble(valuesPosition); long timestampValue = timestampVector.getLong(valuesPosition); - FirstOverTimeDoubleAggregator.combine(state, groupId, valueValue, timestampValue); + LastDoubleByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } } @@ -289,7 +289,7 @@ public void addIntermediateInput(int positionOffset, IntBigArrayBlock groups, Pa for (int g = groupStart; g < groupEnd; g++) { int groupId = groups.getInt(g); int valuesPosition = groupPosition + positionOffset; - FirstOverTimeDoubleAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); + LastDoubleByTimestampAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); } } } @@ -313,7 +313,7 @@ private void addRawInput(int positionOffset, IntVector groups, DoubleBlock value int timestampEnd = timestampStart + timestampBlock.getValueCount(valuesPosition); for (int timestampOffset = timestampStart; timestampOffset < timestampEnd; timestampOffset++) { long timestampValue = timestampBlock.getLong(timestampOffset); - FirstOverTimeDoubleAggregator.combine(state, groupId, valueValue, timestampValue); + LastDoubleByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } } @@ -326,7 +326,7 @@ private void addRawInput(int positionOffset, IntVector groups, DoubleVector valu int groupId = groups.getInt(groupPosition); double valueValue = valueVector.getDouble(valuesPosition); long timestampValue = timestampVector.getLong(valuesPosition); - FirstOverTimeDoubleAggregator.combine(state, groupId, valueValue, timestampValue); + LastDoubleByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } @@ -348,7 +348,7 @@ public void addIntermediateInput(int positionOffset, IntVector groups, Page page for (int groupPosition = 0; groupPosition < groups.getPositionCount(); groupPosition++) { int groupId = groups.getInt(groupPosition); int valuesPosition = groupPosition + positionOffset; - FirstOverTimeDoubleAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); + LastDoubleByTimestampAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); } } @@ -365,7 +365,7 @@ public void evaluateIntermediate(Block[] blocks, int offset, IntVector selected) @Override public void evaluateFinal(Block[] blocks, int offset, IntVector selected, GroupingAggregatorEvaluationContext ctx) { - blocks[offset] = FirstOverTimeDoubleAggregator.evaluateFinal(state, selected, ctx); + blocks[offset] = LastDoubleByTimestampAggregator.evaluateFinal(state, selected, ctx); } @Override diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastFloatByTimestampAggregatorFunctionSupplier.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastFloatByTimestampAggregatorFunctionSupplier.java new file mode 100644 index 0000000000000..9a330782aa31d --- /dev/null +++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastFloatByTimestampAggregatorFunctionSupplier.java @@ -0,0 +1,46 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License +// 2.0; you may not use this file except in compliance with the Elastic License +// 2.0. +package org.elasticsearch.compute.aggregation; + +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.util.List; +import org.elasticsearch.compute.operator.DriverContext; + +/** + * {@link AggregatorFunctionSupplier} implementation for {@link LastFloatByTimestampAggregator}. + * This class is generated. Edit {@code AggregatorFunctionSupplierImplementer} instead. + */ +public final class LastFloatByTimestampAggregatorFunctionSupplier implements AggregatorFunctionSupplier { + public LastFloatByTimestampAggregatorFunctionSupplier() { + } + + @Override + public List nonGroupingIntermediateStateDesc() { + throw new UnsupportedOperationException("non-grouping aggregator is not supported"); + } + + @Override + public List groupingIntermediateStateDesc() { + return LastFloatByTimestampGroupingAggregatorFunction.intermediateStateDesc(); + } + + @Override + public AggregatorFunction aggregator(DriverContext driverContext, List channels) { + throw new UnsupportedOperationException("non-grouping aggregator is not supported"); + } + + @Override + public LastFloatByTimestampGroupingAggregatorFunction groupingAggregator( + DriverContext driverContext, List channels) { + return LastFloatByTimestampGroupingAggregatorFunction.create(channels, driverContext); + } + + @Override + public String describe() { + return "last_float_by of timestamps"; + } +} diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstOverTimeFloatGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastFloatByTimestampGroupingAggregatorFunction.java similarity index 90% rename from x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstOverTimeFloatGroupingAggregatorFunction.java rename to x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastFloatByTimestampGroupingAggregatorFunction.java index 09c581c8f291a..a3498e50fe3c7 100644 --- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstOverTimeFloatGroupingAggregatorFunction.java +++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastFloatByTimestampGroupingAggregatorFunction.java @@ -22,30 +22,30 @@ import org.elasticsearch.compute.operator.DriverContext; /** - * {@link GroupingAggregatorFunction} implementation for {@link FirstOverTimeFloatAggregator}. + * {@link GroupingAggregatorFunction} implementation for {@link LastFloatByTimestampAggregator}. * This class is generated. Edit {@code GroupingAggregatorImplementer} instead. */ -public final class FirstOverTimeFloatGroupingAggregatorFunction implements GroupingAggregatorFunction { +public final class LastFloatByTimestampGroupingAggregatorFunction implements GroupingAggregatorFunction { private static final List INTERMEDIATE_STATE_DESC = List.of( new IntermediateStateDesc("timestamps", ElementType.LONG), new IntermediateStateDesc("values", ElementType.FLOAT) ); - private final FirstOverTimeFloatAggregator.GroupingState state; + private final LastFloatByTimestampAggregator.GroupingState state; private final List channels; private final DriverContext driverContext; - public FirstOverTimeFloatGroupingAggregatorFunction(List channels, - FirstOverTimeFloatAggregator.GroupingState state, DriverContext driverContext) { + public LastFloatByTimestampGroupingAggregatorFunction(List channels, + LastFloatByTimestampAggregator.GroupingState state, DriverContext driverContext) { this.channels = channels; this.state = state; this.driverContext = driverContext; } - public static FirstOverTimeFloatGroupingAggregatorFunction create(List channels, + public static LastFloatByTimestampGroupingAggregatorFunction create(List channels, DriverContext driverContext) { - return new FirstOverTimeFloatGroupingAggregatorFunction(channels, FirstOverTimeFloatAggregator.initGrouping(driverContext), driverContext); + return new LastFloatByTimestampGroupingAggregatorFunction(channels, LastFloatByTimestampAggregator.initGrouping(driverContext), driverContext); } public static List intermediateStateDesc() { @@ -161,7 +161,7 @@ private void addRawInput(int positionOffset, IntArrayBlock groups, FloatBlock va int timestampEnd = timestampStart + timestampBlock.getValueCount(valuesPosition); for (int timestampOffset = timestampStart; timestampOffset < timestampEnd; timestampOffset++) { long timestampValue = timestampBlock.getLong(timestampOffset); - FirstOverTimeFloatAggregator.combine(state, groupId, valueValue, timestampValue); + LastFloatByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } } @@ -181,7 +181,7 @@ private void addRawInput(int positionOffset, IntArrayBlock groups, FloatVector v int groupId = groups.getInt(g); float valueValue = valueVector.getFloat(valuesPosition); long timestampValue = timestampVector.getLong(valuesPosition); - FirstOverTimeFloatAggregator.combine(state, groupId, valueValue, timestampValue); + LastFloatByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } } @@ -210,7 +210,7 @@ public void addIntermediateInput(int positionOffset, IntArrayBlock groups, Page for (int g = groupStart; g < groupEnd; g++) { int groupId = groups.getInt(g); int valuesPosition = groupPosition + positionOffset; - FirstOverTimeFloatAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); + LastFloatByTimestampAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); } } } @@ -240,7 +240,7 @@ private void addRawInput(int positionOffset, IntBigArrayBlock groups, FloatBlock int timestampEnd = timestampStart + timestampBlock.getValueCount(valuesPosition); for (int timestampOffset = timestampStart; timestampOffset < timestampEnd; timestampOffset++) { long timestampValue = timestampBlock.getLong(timestampOffset); - FirstOverTimeFloatAggregator.combine(state, groupId, valueValue, timestampValue); + LastFloatByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } } @@ -260,7 +260,7 @@ private void addRawInput(int positionOffset, IntBigArrayBlock groups, FloatVecto int groupId = groups.getInt(g); float valueValue = valueVector.getFloat(valuesPosition); long timestampValue = timestampVector.getLong(valuesPosition); - FirstOverTimeFloatAggregator.combine(state, groupId, valueValue, timestampValue); + LastFloatByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } } @@ -289,7 +289,7 @@ public void addIntermediateInput(int positionOffset, IntBigArrayBlock groups, Pa for (int g = groupStart; g < groupEnd; g++) { int groupId = groups.getInt(g); int valuesPosition = groupPosition + positionOffset; - FirstOverTimeFloatAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); + LastFloatByTimestampAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); } } } @@ -313,7 +313,7 @@ private void addRawInput(int positionOffset, IntVector groups, FloatBlock valueB int timestampEnd = timestampStart + timestampBlock.getValueCount(valuesPosition); for (int timestampOffset = timestampStart; timestampOffset < timestampEnd; timestampOffset++) { long timestampValue = timestampBlock.getLong(timestampOffset); - FirstOverTimeFloatAggregator.combine(state, groupId, valueValue, timestampValue); + LastFloatByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } } @@ -326,7 +326,7 @@ private void addRawInput(int positionOffset, IntVector groups, FloatVector value int groupId = groups.getInt(groupPosition); float valueValue = valueVector.getFloat(valuesPosition); long timestampValue = timestampVector.getLong(valuesPosition); - FirstOverTimeFloatAggregator.combine(state, groupId, valueValue, timestampValue); + LastFloatByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } @@ -348,7 +348,7 @@ public void addIntermediateInput(int positionOffset, IntVector groups, Page page for (int groupPosition = 0; groupPosition < groups.getPositionCount(); groupPosition++) { int groupId = groups.getInt(groupPosition); int valuesPosition = groupPosition + positionOffset; - FirstOverTimeFloatAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); + LastFloatByTimestampAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); } } @@ -365,7 +365,7 @@ public void evaluateIntermediate(Block[] blocks, int offset, IntVector selected) @Override public void evaluateFinal(Block[] blocks, int offset, IntVector selected, GroupingAggregatorEvaluationContext ctx) { - blocks[offset] = FirstOverTimeFloatAggregator.evaluateFinal(state, selected, ctx); + blocks[offset] = LastFloatByTimestampAggregator.evaluateFinal(state, selected, ctx); } @Override diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstOverTimeFloatAggregatorFunctionSupplier.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastIntByTimestampAggregatorFunctionSupplier.java similarity index 77% rename from x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstOverTimeFloatAggregatorFunctionSupplier.java rename to x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastIntByTimestampAggregatorFunctionSupplier.java index b9fdfc0d508e5..9f5f42d6fb87b 100644 --- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstOverTimeFloatAggregatorFunctionSupplier.java +++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastIntByTimestampAggregatorFunctionSupplier.java @@ -11,11 +11,11 @@ import org.elasticsearch.compute.operator.DriverContext; /** - * {@link AggregatorFunctionSupplier} implementation for {@link FirstOverTimeFloatAggregator}. + * {@link AggregatorFunctionSupplier} implementation for {@link LastIntByTimestampAggregator}. * This class is generated. Edit {@code AggregatorFunctionSupplierImplementer} instead. */ -public final class FirstOverTimeFloatAggregatorFunctionSupplier implements AggregatorFunctionSupplier { - public FirstOverTimeFloatAggregatorFunctionSupplier() { +public final class LastIntByTimestampAggregatorFunctionSupplier implements AggregatorFunctionSupplier { + public LastIntByTimestampAggregatorFunctionSupplier() { } @Override @@ -25,7 +25,7 @@ public List nonGroupingIntermediateStateDesc() { @Override public List groupingIntermediateStateDesc() { - return FirstOverTimeFloatGroupingAggregatorFunction.intermediateStateDesc(); + return LastIntByTimestampGroupingAggregatorFunction.intermediateStateDesc(); } @Override @@ -34,13 +34,13 @@ public AggregatorFunction aggregator(DriverContext driverContext, List } @Override - public FirstOverTimeFloatGroupingAggregatorFunction groupingAggregator( + public LastIntByTimestampGroupingAggregatorFunction groupingAggregator( DriverContext driverContext, List channels) { - return FirstOverTimeFloatGroupingAggregatorFunction.create(channels, driverContext); + return LastIntByTimestampGroupingAggregatorFunction.create(channels, driverContext); } @Override public String describe() { - return "first_over_time of floats"; + return "last_int_by of timestamps"; } } diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstOverTimeIntGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastIntByTimestampGroupingAggregatorFunction.java similarity index 90% rename from x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstOverTimeIntGroupingAggregatorFunction.java rename to x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastIntByTimestampGroupingAggregatorFunction.java index da035e8110315..9a3dd9e1427fa 100644 --- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstOverTimeIntGroupingAggregatorFunction.java +++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastIntByTimestampGroupingAggregatorFunction.java @@ -21,30 +21,30 @@ import org.elasticsearch.compute.operator.DriverContext; /** - * {@link GroupingAggregatorFunction} implementation for {@link FirstOverTimeIntAggregator}. + * {@link GroupingAggregatorFunction} implementation for {@link LastIntByTimestampAggregator}. * This class is generated. Edit {@code GroupingAggregatorImplementer} instead. */ -public final class FirstOverTimeIntGroupingAggregatorFunction implements GroupingAggregatorFunction { +public final class LastIntByTimestampGroupingAggregatorFunction implements GroupingAggregatorFunction { private static final List INTERMEDIATE_STATE_DESC = List.of( new IntermediateStateDesc("timestamps", ElementType.LONG), new IntermediateStateDesc("values", ElementType.INT) ); - private final FirstOverTimeIntAggregator.GroupingState state; + private final LastIntByTimestampAggregator.GroupingState state; private final List channels; private final DriverContext driverContext; - public FirstOverTimeIntGroupingAggregatorFunction(List channels, - FirstOverTimeIntAggregator.GroupingState state, DriverContext driverContext) { + public LastIntByTimestampGroupingAggregatorFunction(List channels, + LastIntByTimestampAggregator.GroupingState state, DriverContext driverContext) { this.channels = channels; this.state = state; this.driverContext = driverContext; } - public static FirstOverTimeIntGroupingAggregatorFunction create(List channels, + public static LastIntByTimestampGroupingAggregatorFunction create(List channels, DriverContext driverContext) { - return new FirstOverTimeIntGroupingAggregatorFunction(channels, FirstOverTimeIntAggregator.initGrouping(driverContext), driverContext); + return new LastIntByTimestampGroupingAggregatorFunction(channels, LastIntByTimestampAggregator.initGrouping(driverContext), driverContext); } public static List intermediateStateDesc() { @@ -160,7 +160,7 @@ private void addRawInput(int positionOffset, IntArrayBlock groups, IntBlock valu int timestampEnd = timestampStart + timestampBlock.getValueCount(valuesPosition); for (int timestampOffset = timestampStart; timestampOffset < timestampEnd; timestampOffset++) { long timestampValue = timestampBlock.getLong(timestampOffset); - FirstOverTimeIntAggregator.combine(state, groupId, valueValue, timestampValue); + LastIntByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } } @@ -180,7 +180,7 @@ private void addRawInput(int positionOffset, IntArrayBlock groups, IntVector val int groupId = groups.getInt(g); int valueValue = valueVector.getInt(valuesPosition); long timestampValue = timestampVector.getLong(valuesPosition); - FirstOverTimeIntAggregator.combine(state, groupId, valueValue, timestampValue); + LastIntByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } } @@ -209,7 +209,7 @@ public void addIntermediateInput(int positionOffset, IntArrayBlock groups, Page for (int g = groupStart; g < groupEnd; g++) { int groupId = groups.getInt(g); int valuesPosition = groupPosition + positionOffset; - FirstOverTimeIntAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); + LastIntByTimestampAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); } } } @@ -239,7 +239,7 @@ private void addRawInput(int positionOffset, IntBigArrayBlock groups, IntBlock v int timestampEnd = timestampStart + timestampBlock.getValueCount(valuesPosition); for (int timestampOffset = timestampStart; timestampOffset < timestampEnd; timestampOffset++) { long timestampValue = timestampBlock.getLong(timestampOffset); - FirstOverTimeIntAggregator.combine(state, groupId, valueValue, timestampValue); + LastIntByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } } @@ -259,7 +259,7 @@ private void addRawInput(int positionOffset, IntBigArrayBlock groups, IntVector int groupId = groups.getInt(g); int valueValue = valueVector.getInt(valuesPosition); long timestampValue = timestampVector.getLong(valuesPosition); - FirstOverTimeIntAggregator.combine(state, groupId, valueValue, timestampValue); + LastIntByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } } @@ -288,7 +288,7 @@ public void addIntermediateInput(int positionOffset, IntBigArrayBlock groups, Pa for (int g = groupStart; g < groupEnd; g++) { int groupId = groups.getInt(g); int valuesPosition = groupPosition + positionOffset; - FirstOverTimeIntAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); + LastIntByTimestampAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); } } } @@ -312,7 +312,7 @@ private void addRawInput(int positionOffset, IntVector groups, IntBlock valueBlo int timestampEnd = timestampStart + timestampBlock.getValueCount(valuesPosition); for (int timestampOffset = timestampStart; timestampOffset < timestampEnd; timestampOffset++) { long timestampValue = timestampBlock.getLong(timestampOffset); - FirstOverTimeIntAggregator.combine(state, groupId, valueValue, timestampValue); + LastIntByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } } @@ -325,7 +325,7 @@ private void addRawInput(int positionOffset, IntVector groups, IntVector valueVe int groupId = groups.getInt(groupPosition); int valueValue = valueVector.getInt(valuesPosition); long timestampValue = timestampVector.getLong(valuesPosition); - FirstOverTimeIntAggregator.combine(state, groupId, valueValue, timestampValue); + LastIntByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } @@ -347,7 +347,7 @@ public void addIntermediateInput(int positionOffset, IntVector groups, Page page for (int groupPosition = 0; groupPosition < groups.getPositionCount(); groupPosition++) { int groupId = groups.getInt(groupPosition); int valuesPosition = groupPosition + positionOffset; - FirstOverTimeIntAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); + LastIntByTimestampAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); } } @@ -364,7 +364,7 @@ public void evaluateIntermediate(Block[] blocks, int offset, IntVector selected) @Override public void evaluateFinal(Block[] blocks, int offset, IntVector selected, GroupingAggregatorEvaluationContext ctx) { - blocks[offset] = FirstOverTimeIntAggregator.evaluateFinal(state, selected, ctx); + blocks[offset] = LastIntByTimestampAggregator.evaluateFinal(state, selected, ctx); } @Override diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastOverTimeDoubleAggregatorFunctionSupplier.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastLongByTimestampAggregatorFunctionSupplier.java similarity index 71% rename from x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastOverTimeDoubleAggregatorFunctionSupplier.java rename to x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastLongByTimestampAggregatorFunctionSupplier.java index b45b106373539..84948a1b9fa22 100644 --- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastOverTimeDoubleAggregatorFunctionSupplier.java +++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastLongByTimestampAggregatorFunctionSupplier.java @@ -11,11 +11,11 @@ import org.elasticsearch.compute.operator.DriverContext; /** - * {@link AggregatorFunctionSupplier} implementation for {@link LastOverTimeDoubleAggregator}. + * {@link AggregatorFunctionSupplier} implementation for {@link LastLongByTimestampAggregator}. * This class is generated. Edit {@code AggregatorFunctionSupplierImplementer} instead. */ -public final class LastOverTimeDoubleAggregatorFunctionSupplier implements AggregatorFunctionSupplier { - public LastOverTimeDoubleAggregatorFunctionSupplier() { +public final class LastLongByTimestampAggregatorFunctionSupplier implements AggregatorFunctionSupplier { + public LastLongByTimestampAggregatorFunctionSupplier() { } @Override @@ -25,7 +25,7 @@ public List nonGroupingIntermediateStateDesc() { @Override public List groupingIntermediateStateDesc() { - return LastOverTimeDoubleGroupingAggregatorFunction.intermediateStateDesc(); + return LastLongByTimestampGroupingAggregatorFunction.intermediateStateDesc(); } @Override @@ -34,13 +34,13 @@ public AggregatorFunction aggregator(DriverContext driverContext, List } @Override - public LastOverTimeDoubleGroupingAggregatorFunction groupingAggregator( + public LastLongByTimestampGroupingAggregatorFunction groupingAggregator( DriverContext driverContext, List channels) { - return LastOverTimeDoubleGroupingAggregatorFunction.create(channels, driverContext); + return LastLongByTimestampGroupingAggregatorFunction.create(channels, driverContext); } @Override public String describe() { - return "last_over_time of doubles"; + return "last_long_by of timestamps"; } } diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstOverTimeLongGroupingAggregatorFunction.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastLongByTimestampGroupingAggregatorFunction.java similarity index 90% rename from x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstOverTimeLongGroupingAggregatorFunction.java rename to x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastLongByTimestampGroupingAggregatorFunction.java index 7425aba3f430d..ae484682af85b 100644 --- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/FirstOverTimeLongGroupingAggregatorFunction.java +++ b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastLongByTimestampGroupingAggregatorFunction.java @@ -20,30 +20,30 @@ import org.elasticsearch.compute.operator.DriverContext; /** - * {@link GroupingAggregatorFunction} implementation for {@link FirstOverTimeLongAggregator}. + * {@link GroupingAggregatorFunction} implementation for {@link LastLongByTimestampAggregator}. * This class is generated. Edit {@code GroupingAggregatorImplementer} instead. */ -public final class FirstOverTimeLongGroupingAggregatorFunction implements GroupingAggregatorFunction { +public final class LastLongByTimestampGroupingAggregatorFunction implements GroupingAggregatorFunction { private static final List INTERMEDIATE_STATE_DESC = List.of( new IntermediateStateDesc("timestamps", ElementType.LONG), new IntermediateStateDesc("values", ElementType.LONG) ); - private final FirstOverTimeLongAggregator.GroupingState state; + private final LastLongByTimestampAggregator.GroupingState state; private final List channels; private final DriverContext driverContext; - public FirstOverTimeLongGroupingAggregatorFunction(List channels, - FirstOverTimeLongAggregator.GroupingState state, DriverContext driverContext) { + public LastLongByTimestampGroupingAggregatorFunction(List channels, + LastLongByTimestampAggregator.GroupingState state, DriverContext driverContext) { this.channels = channels; this.state = state; this.driverContext = driverContext; } - public static FirstOverTimeLongGroupingAggregatorFunction create(List channels, + public static LastLongByTimestampGroupingAggregatorFunction create(List channels, DriverContext driverContext) { - return new FirstOverTimeLongGroupingAggregatorFunction(channels, FirstOverTimeLongAggregator.initGrouping(driverContext), driverContext); + return new LastLongByTimestampGroupingAggregatorFunction(channels, LastLongByTimestampAggregator.initGrouping(driverContext), driverContext); } public static List intermediateStateDesc() { @@ -159,7 +159,7 @@ private void addRawInput(int positionOffset, IntArrayBlock groups, LongBlock val int timestampEnd = timestampStart + timestampBlock.getValueCount(valuesPosition); for (int timestampOffset = timestampStart; timestampOffset < timestampEnd; timestampOffset++) { long timestampValue = timestampBlock.getLong(timestampOffset); - FirstOverTimeLongAggregator.combine(state, groupId, valueValue, timestampValue); + LastLongByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } } @@ -179,7 +179,7 @@ private void addRawInput(int positionOffset, IntArrayBlock groups, LongVector va int groupId = groups.getInt(g); long valueValue = valueVector.getLong(valuesPosition); long timestampValue = timestampVector.getLong(valuesPosition); - FirstOverTimeLongAggregator.combine(state, groupId, valueValue, timestampValue); + LastLongByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } } @@ -208,7 +208,7 @@ public void addIntermediateInput(int positionOffset, IntArrayBlock groups, Page for (int g = groupStart; g < groupEnd; g++) { int groupId = groups.getInt(g); int valuesPosition = groupPosition + positionOffset; - FirstOverTimeLongAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); + LastLongByTimestampAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); } } } @@ -238,7 +238,7 @@ private void addRawInput(int positionOffset, IntBigArrayBlock groups, LongBlock int timestampEnd = timestampStart + timestampBlock.getValueCount(valuesPosition); for (int timestampOffset = timestampStart; timestampOffset < timestampEnd; timestampOffset++) { long timestampValue = timestampBlock.getLong(timestampOffset); - FirstOverTimeLongAggregator.combine(state, groupId, valueValue, timestampValue); + LastLongByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } } @@ -258,7 +258,7 @@ private void addRawInput(int positionOffset, IntBigArrayBlock groups, LongVector int groupId = groups.getInt(g); long valueValue = valueVector.getLong(valuesPosition); long timestampValue = timestampVector.getLong(valuesPosition); - FirstOverTimeLongAggregator.combine(state, groupId, valueValue, timestampValue); + LastLongByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } } @@ -287,7 +287,7 @@ public void addIntermediateInput(int positionOffset, IntBigArrayBlock groups, Pa for (int g = groupStart; g < groupEnd; g++) { int groupId = groups.getInt(g); int valuesPosition = groupPosition + positionOffset; - FirstOverTimeLongAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); + LastLongByTimestampAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); } } } @@ -311,7 +311,7 @@ private void addRawInput(int positionOffset, IntVector groups, LongBlock valueBl int timestampEnd = timestampStart + timestampBlock.getValueCount(valuesPosition); for (int timestampOffset = timestampStart; timestampOffset < timestampEnd; timestampOffset++) { long timestampValue = timestampBlock.getLong(timestampOffset); - FirstOverTimeLongAggregator.combine(state, groupId, valueValue, timestampValue); + LastLongByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } } @@ -324,7 +324,7 @@ private void addRawInput(int positionOffset, IntVector groups, LongVector valueV int groupId = groups.getInt(groupPosition); long valueValue = valueVector.getLong(valuesPosition); long timestampValue = timestampVector.getLong(valuesPosition); - FirstOverTimeLongAggregator.combine(state, groupId, valueValue, timestampValue); + LastLongByTimestampAggregator.combine(state, groupId, valueValue, timestampValue); } } @@ -346,7 +346,7 @@ public void addIntermediateInput(int positionOffset, IntVector groups, Page page for (int groupPosition = 0; groupPosition < groups.getPositionCount(); groupPosition++) { int groupId = groups.getInt(groupPosition); int valuesPosition = groupPosition + positionOffset; - FirstOverTimeLongAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); + LastLongByTimestampAggregator.combineIntermediate(state, groupId, timestamps, values, valuesPosition); } } @@ -363,7 +363,7 @@ public void evaluateIntermediate(Block[] blocks, int offset, IntVector selected) @Override public void evaluateFinal(Block[] blocks, int offset, IntVector selected, GroupingAggregatorEvaluationContext ctx) { - blocks[offset] = FirstOverTimeLongAggregator.evaluateFinal(state, selected, ctx); + blocks[offset] = LastLongByTimestampAggregator.evaluateFinal(state, selected, ctx); } @Override diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastOverTimeFloatAggregatorFunctionSupplier.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastOverTimeFloatAggregatorFunctionSupplier.java deleted file mode 100644 index 17a714939a460..0000000000000 --- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastOverTimeFloatAggregatorFunctionSupplier.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one -// or more contributor license agreements. Licensed under the Elastic License -// 2.0; you may not use this file except in compliance with the Elastic License -// 2.0. -package org.elasticsearch.compute.aggregation; - -import java.lang.Integer; -import java.lang.Override; -import java.lang.String; -import java.util.List; -import org.elasticsearch.compute.operator.DriverContext; - -/** - * {@link AggregatorFunctionSupplier} implementation for {@link LastOverTimeFloatAggregator}. - * This class is generated. Edit {@code AggregatorFunctionSupplierImplementer} instead. - */ -public final class LastOverTimeFloatAggregatorFunctionSupplier implements AggregatorFunctionSupplier { - public LastOverTimeFloatAggregatorFunctionSupplier() { - } - - @Override - public List nonGroupingIntermediateStateDesc() { - throw new UnsupportedOperationException("non-grouping aggregator is not supported"); - } - - @Override - public List groupingIntermediateStateDesc() { - return LastOverTimeFloatGroupingAggregatorFunction.intermediateStateDesc(); - } - - @Override - public AggregatorFunction aggregator(DriverContext driverContext, List channels) { - throw new UnsupportedOperationException("non-grouping aggregator is not supported"); - } - - @Override - public LastOverTimeFloatGroupingAggregatorFunction groupingAggregator(DriverContext driverContext, - List channels) { - return LastOverTimeFloatGroupingAggregatorFunction.create(channels, driverContext); - } - - @Override - public String describe() { - return "last_over_time of floats"; - } -} diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastOverTimeIntAggregatorFunctionSupplier.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastOverTimeIntAggregatorFunctionSupplier.java deleted file mode 100644 index 55230f932c681..0000000000000 --- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastOverTimeIntAggregatorFunctionSupplier.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one -// or more contributor license agreements. Licensed under the Elastic License -// 2.0; you may not use this file except in compliance with the Elastic License -// 2.0. -package org.elasticsearch.compute.aggregation; - -import java.lang.Integer; -import java.lang.Override; -import java.lang.String; -import java.util.List; -import org.elasticsearch.compute.operator.DriverContext; - -/** - * {@link AggregatorFunctionSupplier} implementation for {@link LastOverTimeIntAggregator}. - * This class is generated. Edit {@code AggregatorFunctionSupplierImplementer} instead. - */ -public final class LastOverTimeIntAggregatorFunctionSupplier implements AggregatorFunctionSupplier { - public LastOverTimeIntAggregatorFunctionSupplier() { - } - - @Override - public List nonGroupingIntermediateStateDesc() { - throw new UnsupportedOperationException("non-grouping aggregator is not supported"); - } - - @Override - public List groupingIntermediateStateDesc() { - return LastOverTimeIntGroupingAggregatorFunction.intermediateStateDesc(); - } - - @Override - public AggregatorFunction aggregator(DriverContext driverContext, List channels) { - throw new UnsupportedOperationException("non-grouping aggregator is not supported"); - } - - @Override - public LastOverTimeIntGroupingAggregatorFunction groupingAggregator(DriverContext driverContext, - List channels) { - return LastOverTimeIntGroupingAggregatorFunction.create(channels, driverContext); - } - - @Override - public String describe() { - return "last_over_time of ints"; - } -} diff --git a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastOverTimeLongAggregatorFunctionSupplier.java b/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastOverTimeLongAggregatorFunctionSupplier.java deleted file mode 100644 index 4223c27b21216..0000000000000 --- a/x-pack/plugin/esql/compute/src/main/generated/org/elasticsearch/compute/aggregation/LastOverTimeLongAggregatorFunctionSupplier.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one -// or more contributor license agreements. Licensed under the Elastic License -// 2.0; you may not use this file except in compliance with the Elastic License -// 2.0. -package org.elasticsearch.compute.aggregation; - -import java.lang.Integer; -import java.lang.Override; -import java.lang.String; -import java.util.List; -import org.elasticsearch.compute.operator.DriverContext; - -/** - * {@link AggregatorFunctionSupplier} implementation for {@link LastOverTimeLongAggregator}. - * This class is generated. Edit {@code AggregatorFunctionSupplierImplementer} instead. - */ -public final class LastOverTimeLongAggregatorFunctionSupplier implements AggregatorFunctionSupplier { - public LastOverTimeLongAggregatorFunctionSupplier() { - } - - @Override - public List nonGroupingIntermediateStateDesc() { - throw new UnsupportedOperationException("non-grouping aggregator is not supported"); - } - - @Override - public List groupingIntermediateStateDesc() { - return LastOverTimeLongGroupingAggregatorFunction.intermediateStateDesc(); - } - - @Override - public AggregatorFunction aggregator(DriverContext driverContext, List channels) { - throw new UnsupportedOperationException("non-grouping aggregator is not supported"); - } - - @Override - public LastOverTimeLongGroupingAggregatorFunction groupingAggregator(DriverContext driverContext, - List channels) { - return LastOverTimeLongGroupingAggregatorFunction.create(channels, driverContext); - } - - @Override - public String describe() { - return "last_over_time of longs"; - } -} diff --git a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/X-ValueOverTimeAggregator.java.st b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/X-ValueByTimestampAggregator.java.st similarity index 95% rename from x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/X-ValueOverTimeAggregator.java.st rename to x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/X-ValueByTimestampAggregator.java.st index 1935ae5948325..7d5248abeaabe 100644 --- a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/X-ValueOverTimeAggregator.java.st +++ b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/X-ValueByTimestampAggregator.java.st @@ -25,18 +25,16 @@ import org.elasticsearch.core.Releasables; /** * A time-series aggregation function that collects the $Occurrence$ occurrence value of a time series in a specified interval. - * This class is generated. Edit `X-ValueOverTimeAggregator.java.st` instead. + * This class is generated. Edit `X-ValueByTimestampAggregator.java.st` instead. */ @GroupingAggregator( { @IntermediateState(name = "timestamps", type = "LONG_BLOCK"), @IntermediateState(name = "values", type = "$TYPE$_BLOCK") } ) -public class $Occurrence$OverTime$Type$Aggregator { +public class $Occurrence$$Type$ByTimestampAggregator { public static GroupingState initGrouping(DriverContext driverContext) { return new GroupingState(driverContext.bigArrays()); } - // TODO: Since data in data_streams is sorted by `_tsid` and timestamp in descending order, - // we can read the first encountered value for each group of `_tsid` and time bucket. public static void combine(GroupingState current, int groupId, $type$ value, long timestamp) { current.collectValue(groupId, timestamp, value); } diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/FirstOverTime.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/FirstOverTime.java index 8ffa7cb5110a4..1be78f157ad06 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/FirstOverTime.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/FirstOverTime.java @@ -10,10 +10,10 @@ import org.elasticsearch.common.io.stream.NamedWriteableRegistry; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.compute.aggregation.AggregatorFunctionSupplier; -import org.elasticsearch.compute.aggregation.FirstOverTimeDoubleAggregatorFunctionSupplier; -import org.elasticsearch.compute.aggregation.FirstOverTimeFloatAggregatorFunctionSupplier; -import org.elasticsearch.compute.aggregation.FirstOverTimeIntAggregatorFunctionSupplier; -import org.elasticsearch.compute.aggregation.FirstOverTimeLongAggregatorFunctionSupplier; +import org.elasticsearch.compute.aggregation.FirstDoubleByTimestampAggregatorFunctionSupplier; +import org.elasticsearch.compute.aggregation.FirstFloatByTimestampAggregatorFunctionSupplier; +import org.elasticsearch.compute.aggregation.FirstIntByTimestampAggregatorFunctionSupplier; +import org.elasticsearch.compute.aggregation.FirstLongByTimestampAggregatorFunctionSupplier; import org.elasticsearch.xpack.esql.EsqlIllegalArgumentException; import org.elasticsearch.xpack.esql.core.expression.Expression; import org.elasticsearch.xpack.esql.core.expression.Literal; @@ -128,12 +128,14 @@ protected TypeResolution resolveType() { @Override public AggregatorFunctionSupplier supplier() { + // TODO: When processing TSDB data_streams they are sorted by `_tsid` and timestamp in descending order, + // we can read the first encountered value for each group of `_tsid` and time bucket. final DataType type = field().dataType(); return switch (type) { - case LONG -> new FirstOverTimeLongAggregatorFunctionSupplier(); - case INTEGER -> new FirstOverTimeIntAggregatorFunctionSupplier(); - case DOUBLE -> new FirstOverTimeDoubleAggregatorFunctionSupplier(); - case FLOAT -> new FirstOverTimeFloatAggregatorFunctionSupplier(); + case LONG -> new FirstLongByTimestampAggregatorFunctionSupplier(); + case INTEGER -> new FirstIntByTimestampAggregatorFunctionSupplier(); + case DOUBLE -> new FirstDoubleByTimestampAggregatorFunctionSupplier(); + case FLOAT -> new FirstFloatByTimestampAggregatorFunctionSupplier(); default -> throw EsqlIllegalArgumentException.illegalDataType(type); }; } diff --git a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/LastOverTime.java b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/LastOverTime.java index 6bdf40dd32679..de8d48b2ca9b8 100644 --- a/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/LastOverTime.java +++ b/x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/aggregate/LastOverTime.java @@ -10,10 +10,10 @@ import org.elasticsearch.common.io.stream.NamedWriteableRegistry; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.compute.aggregation.AggregatorFunctionSupplier; -import org.elasticsearch.compute.aggregation.LastOverTimeDoubleAggregatorFunctionSupplier; -import org.elasticsearch.compute.aggregation.LastOverTimeFloatAggregatorFunctionSupplier; -import org.elasticsearch.compute.aggregation.LastOverTimeIntAggregatorFunctionSupplier; -import org.elasticsearch.compute.aggregation.LastOverTimeLongAggregatorFunctionSupplier; +import org.elasticsearch.compute.aggregation.LastDoubleByTimestampAggregatorFunctionSupplier; +import org.elasticsearch.compute.aggregation.LastFloatByTimestampAggregatorFunctionSupplier; +import org.elasticsearch.compute.aggregation.LastIntByTimestampAggregatorFunctionSupplier; +import org.elasticsearch.compute.aggregation.LastLongByTimestampAggregatorFunctionSupplier; import org.elasticsearch.xpack.esql.EsqlIllegalArgumentException; import org.elasticsearch.xpack.esql.core.expression.Expression; import org.elasticsearch.xpack.esql.core.expression.Literal; @@ -128,12 +128,14 @@ protected TypeResolution resolveType() { @Override public AggregatorFunctionSupplier supplier() { + // TODO: When processing TSDB data_streams they are sorted by `_tsid` and timestamp in descending order, + // we can read the first encountered value for each group of `_tsid` and time bucket. final DataType type = field().dataType(); return switch (type) { - case LONG -> new LastOverTimeLongAggregatorFunctionSupplier(); - case INTEGER -> new LastOverTimeIntAggregatorFunctionSupplier(); - case DOUBLE -> new LastOverTimeDoubleAggregatorFunctionSupplier(); - case FLOAT -> new LastOverTimeFloatAggregatorFunctionSupplier(); + case LONG -> new LastLongByTimestampAggregatorFunctionSupplier(); + case INTEGER -> new LastIntByTimestampAggregatorFunctionSupplier(); + case DOUBLE -> new LastDoubleByTimestampAggregatorFunctionSupplier(); + case FLOAT -> new LastFloatByTimestampAggregatorFunctionSupplier(); default -> throw EsqlIllegalArgumentException.illegalDataType(type); }; }