Skip to content

Commit ea6f9e3

Browse files
committed
Round sum and avg in exponential_histogram CSV tests
1 parent d6c0090 commit ea6f9e3

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

x-pack/plugin/esql/qa/testFixtures/src/main/resources/exponential_histogram.csv-spec

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ required_capability: exponential_histogram_pre_tech_preview_v2
2222
FROM exp_histo_sample
2323
| EVAL instance = CASE(STARTS_WITH(instance, "dummy"), "dummy-grouped", instance)
2424
| STATS min = MIN(responseTime), max = MAX(responseTime), median = MEDIAN(responseTime), p75 = PERCENTILE(responseTime,75), sum = SUM(responseTime), avg = AVG(responseTime) BY instance
25-
| EVAL median = ROUND(median, 7), p75 = ROUND(p75, 7) // rounding to avoid floating point precision issues
25+
| EVAL median = ROUND(median, 7), p75 = ROUND(p75, 7), sum = ROUND(sum, 7), avg = ROUND(avg, 7) // rounding to avoid floating point precision issues
2626
| KEEP instance, min, max, median, p75, sum, avg
2727
| SORT instance
2828
;
2929

30-
instance:keyword | min:double | max:double | median:double | p75:double | sum:double | avg:double
31-
dummy-grouped | -100.0 | 50.0 | 0.0 | 8.3457089 | -7550.0 | -15.0398406374502
32-
instance-0 | 2.4E-4 | 6.786232 | 0.0211404 | 0.2608237 | 1472.744209 | 0.1665811796176903
33-
instance-1 | 2.17E-4 | 3.190723 | 6.469E-4 | 0.0016068 | 36.198484 | 0.011137995076923077
34-
instance-2 | 2.2E-4 | 2.744054 | 6.469E-4 | 0.0016068 | 27.706021000000003 | 0.008197047633136096
30+
instance:keyword | min:double | max:double | median:double | p75:double | sum:double | avg:double
31+
dummy-grouped | -100.0 | 50.0 | 0.0 | 8.3457089 | -7550.0 | -15.0398406
32+
instance-0 | 2.4E-4 | 6.786232 | 0.0211404 | 0.2608237 | 1472.744209 | 0.1665812
33+
instance-1 | 2.17E-4 | 3.190723 | 6.469E-4 | 0.0016068 | 36.198484 | 0.011138
34+
instance-2 | 2.2E-4 | 2.744054 | 6.469E-4 | 0.0016068 | 27.706021 | 0.008197
3535
;
3636

3737

@@ -45,12 +45,12 @@ FROM exp_histo_sample
4545
p75 = PERCENTILE(responseTime,75) WHERE instance == "instance-0",
4646
sum = SUM(responseTime) WHERE instance == "instance-1",
4747
avg = AVG(responseTime) WHERE instance == "instance-2"
48-
| EVAL median = ROUND(median, 7), p75 = ROUND(p75, 7) // rounding to avoid floating point precision issues
48+
| EVAL median = ROUND(median, 7), p75 = ROUND(p75, 7), sum = ROUND(sum, 7), avg = ROUND(avg, 7) // rounding to avoid floating point precision issues
4949
| KEEP min, max, median, p75, sum, avg
5050
;
5151

5252
min:double | max:double | median:double | p75:double | sum:double | avg:double
53-
2.4E-4 | 3.190723 | 6.469E-4 | 0.2608237 | 36.198484 | 0.008197047633136096
53+
2.4E-4 | 3.190723 | 6.469E-4 | 0.2608237 | 36.198484 | 0.008197
5454
;
5555

5656

@@ -59,8 +59,8 @@ required_capability: exponential_histogram_pre_tech_preview_v2
5959

6060
FROM exp_histo_sample
6161
| INLINE STATS min = MIN(responseTime), max = MAX(responseTime), median = MEDIAN(responseTime), p75 = PERCENTILE(responseTime,75), sum = SUM(responseTime), avg = AVG(responseTime) BY instance
62-
| EVAL median = ROUND(median, 7), p75 = ROUND(p75, 7) // rounding to avoid floating point precision issues
63-
| KEEP instance, min, max, median, p75, sum , avg
62+
| EVAL median = ROUND(median, 7), p75 = ROUND(p75, 7), sum = ROUND(sum, 7), avg = ROUND(avg, 7) // rounding to avoid floating point precision issues
63+
| KEEP instance, min, max, median, p75, sum, avg
6464
| SORT instance
6565
| Limit 15
6666
;
@@ -69,18 +69,18 @@ instance:keyword | min:double | max:double | median:double | p75:double
6969
dummy-empty | null | null | null | null | null | null
7070
dummy-full | -100.0 | 50.0 | -21.3333333 | 10.6666667 | -3775.0 | -25.0
7171
dummy-negative_only | -50.0 | -1.0 | -24.5830421 | -12.8729318 | -1275.0 | -25.5
72-
dummy-no_zero_bucket | -100.0 | 50.0 | -21.3333333 | 10.6666667 | -3775.0 | -25.166666666666668
72+
dummy-no_zero_bucket | -100.0 | 50.0 | -21.3333333 | 10.6666667 | -3775.0 | -25.1666667
7373
dummy-positive_only | 1.0 | 50.0 | 24.5830421 | 34.7656715 | 1275.0 | 25.5
7474
dummy-zero_count_only | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0
7575
dummy-zero_threshold_only | null | null | null | null | null | null
76-
instance-0 | 2.4E-4 | 6.786232 | 0.0211404 | 0.2608237 | 1472.744209 | 0.1665811796176903
77-
instance-0 | 2.4E-4 | 6.786232 | 0.0211404 | 0.2608237 | 1472.744209 | 0.1665811796176903
78-
instance-0 | 2.4E-4 | 6.786232 | 0.0211404 | 0.2608237 | 1472.744209 | 0.1665811796176903
79-
instance-0 | 2.4E-4 | 6.786232 | 0.0211404 | 0.2608237 | 1472.744209 | 0.1665811796176903
80-
instance-0 | 2.4E-4 | 6.786232 | 0.0211404 | 0.2608237 | 1472.744209 | 0.1665811796176903
81-
instance-0 | 2.4E-4 | 6.786232 | 0.0211404 | 0.2608237 | 1472.744209 | 0.1665811796176903
82-
instance-0 | 2.4E-4 | 6.786232 | 0.0211404 | 0.2608237 | 1472.744209 | 0.1665811796176903
83-
instance-0 | 2.4E-4 | 6.786232 | 0.0211404 | 0.2608237 | 1472.744209 | 0.1665811796176903
76+
instance-0 | 2.4E-4 | 6.786232 | 0.0211404 | 0.2608237 | 1472.744209 | 0.1665812
77+
instance-0 | 2.4E-4 | 6.786232 | 0.0211404 | 0.2608237 | 1472.744209 | 0.1665812
78+
instance-0 | 2.4E-4 | 6.786232 | 0.0211404 | 0.2608237 | 1472.744209 | 0.1665812
79+
instance-0 | 2.4E-4 | 6.786232 | 0.0211404 | 0.2608237 | 1472.744209 | 0.1665812
80+
instance-0 | 2.4E-4 | 6.786232 | 0.0211404 | 0.2608237 | 1472.744209 | 0.1665812
81+
instance-0 | 2.4E-4 | 6.786232 | 0.0211404 | 0.2608237 | 1472.744209 | 0.1665812
82+
instance-0 | 2.4E-4 | 6.786232 | 0.0211404 | 0.2608237 | 1472.744209 | 0.1665812
83+
instance-0 | 2.4E-4 | 6.786232 | 0.0211404 | 0.2608237 | 1472.744209 | 0.1665812
8484
;
8585

8686

@@ -207,36 +207,36 @@ ungroupedAvg
207207
required_capability: exponential_histogram_pre_tech_preview_v2
208208

209209
FROM exp_histo_sample | WHERE NOT STARTS_WITH(instance, "dummy")
210-
| STATS avg = AVG(responseTime)
210+
| STATS avg = ROUND(AVG(responseTime), 7) // rounding to avoid floating point precision issues
211211
| KEEP avg
212212
;
213213

214214
avg:double
215-
0.09932445956951716
215+
0.0993245
216216
;
217217

218218

219219
groupedAvg
220220
required_capability: exponential_histogram_pre_tech_preview_v2
221221

222222
FROM exp_histo_sample | WHERE NOT STARTS_WITH(instance, "dummy")
223-
| STATS avg = AVG(responseTime) BY instance
223+
| STATS avg = ROUND(AVG(responseTime), 7) BY instance // rounding to avoid floating point precision issues
224224
| KEEP instance, avg
225225
| SORT instance
226226
;
227227

228228
instance:keyword | avg:double
229-
instance-0 | 0.1665811796176903
230-
instance-1 | 0.011137995076923077
231-
instance-2 | 0.008197047633136096
229+
instance-0 | 0.1665812
230+
instance-1 | 0.011138
231+
instance-2 | 0.008197
232232
;
233233

234234

235235
avgOnEmptyHistogram
236236
required_capability: exponential_histogram_pre_tech_preview_v2
237237

238238
FROM exp_histo_sample | WHERE instance == "dummy-empty"
239-
| STATS avg = AVG(responseTime)
239+
| STATS avg = AVG(responseTime)
240240
| KEEP avg
241241
;
242242

@@ -249,7 +249,7 @@ ungroupedSum
249249
required_capability: exponential_histogram_pre_tech_preview_v2
250250

251251
FROM exp_histo_sample | WHERE NOT STARTS_WITH(instance, "dummy")
252-
| STATS sum = SUM(responseTime)
252+
| STATS sum = ROUND(SUM(responseTime), 7) // rounding to avoid floating point precision issues
253253
| KEEP sum
254254
;
255255

@@ -262,13 +262,13 @@ groupedSum
262262
required_capability: exponential_histogram_pre_tech_preview_v2
263263

264264
FROM exp_histo_sample | WHERE NOT STARTS_WITH(instance, "dummy")
265-
| STATS sum = SUM(responseTime) BY instance
265+
| STATS sum = ROUND(SUM(responseTime), 7) BY instance // rounding to avoid floating point precision issues
266266
| KEEP instance, sum
267267
| SORT instance
268268
;
269269

270270
instance:keyword | sum:double
271271
instance-0 | 1472.744209
272272
instance-1 | 36.198484
273-
instance-2 | 27.706021000000003
273+
instance-2 | 27.706021
274274
;

0 commit comments

Comments
 (0)