Skip to content

Commit bffe2d2

Browse files
committed
assertion
1 parent 51e0b6b commit bffe2d2

File tree

5 files changed

+10
-0
lines changed

5 files changed

+10
-0
lines changed

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

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

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

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

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

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

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

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

x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/X-RateAggregator.java.st

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ public class Rate$Type$Aggregator {
323323

324324
private static double computeRateWithoutExtrapolate($Type$RateState state, long unitInMillis) {
325325
final int len = state.entries();
326+
assert len >= 2 : "rate requires at least two samples; got " + len;
326327
final long firstTS = state.timestamps[state.timestamps.length - 1];
327328
final long lastTS = state.timestamps[0];
328329
double reset = state.reset;
@@ -347,6 +348,7 @@ public class Rate$Type$Aggregator {
347348
*/
348349
private static double extrapolateRate($Type$RateState state, long rangeStart, long rangeEnd, long unitInMillis) {
349350
final int len = state.entries();
351+
assert len >= 2 : "rate requires at least two samples; got " + len;
350352
final long firstTS = state.timestamps[state.timestamps.length - 1];
351353
final long lastTS = state.timestamps[0];
352354
double reset = state.reset;

0 commit comments

Comments
 (0)