Skip to content

Commit b9357b2

Browse files
committed
optimize many_numbers test
1 parent 900dfdb commit b9357b2

File tree

3 files changed

+10026
-500510
lines changed

3 files changed

+10026
-500510
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
// Tests focused on query approximation.
2+
//
3+
// The data set "many_numbers" contains 10,000 rows with a multi-valued field
4+
// "value" containing 550 integers each. Aggregated all over rows, there are
5+
// 1x1, 2x2, ..., 999x999 and 1000x1000. It's not one number per row, because
6+
// that's too slow to ingest.
7+
//
28
// Note: this tests only basic behavior, because of limitations of the CSV tests.
39
// Most tests assert that the count, average and sum of some values are within a
410
// range. All ranges are very loose, so that the tests should practically never fail.
@@ -10,6 +16,7 @@ required_capability: approximate
1016
approximate: true
1117

1218
FROM many_numbers
19+
| MV_EXPAND value
1320
| STATS count=COUNT(), avg=AVG(value), sum=SUM(value)
1421
| EVAL is_expected = count >= 450000 AND count <= 550000 AND
1522
avg >= 600 AND avg <= 750 AND
@@ -27,6 +34,7 @@ required_capability: approximate
2734
approximate: true
2835

2936
FROM many_numbers
37+
| MV_EXPAND value
3038
| WHERE value <= 25
3139
| STATS count=COUNT(), avg=AVG(value), sum=SUM(value)
3240
;
@@ -41,6 +49,7 @@ required_capability: approximate
4149
approximate: true
4250

4351
FROM many_numbers
52+
| MV_EXPAND value
4453
| WHERE value >= 500
4554
| STATS count=COUNT(), avg=AVG(value), sum=SUM(value)
4655
| EVAL is_expected = count >= 300000 AND count <= 450000 AND
@@ -59,6 +68,7 @@ required_capability: approximate
5968
approximate: true
6069

6170
FROM many_numbers
71+
| MV_EXPAND value
6272
| STATS count=COUNT() WHERE value >= 500,
6373
avg=AVG(value) WHERE value >= 500,
6474
sum=SUM(value) WHERE value >= 500
@@ -78,6 +88,7 @@ required_capability: approximate
7888
approximate: true
7989

8090
FROM many_numbers
91+
| MV_EXPAND value
8192
| SAMPLE 0.5
8293
| STATS count=COUNT(), avg=AVG(value), sum=SUM(value)
8394
| EVAL is_expected = count >= 200000 AND count <= 300000 AND
@@ -96,6 +107,7 @@ required_capability: approximate
96107
approximate: true
97108

98109
FROM many_numbers
110+
| MV_EXPAND value
99111
| EVAL value2 = 2 * value
100112
| DROP value
101113
| SORT value2 DESC
@@ -123,6 +135,7 @@ required_capability: approximate
123135
approximate: true
124136

125137
FROM many_numbers
138+
| MV_EXPAND value
126139
| STATS count=COUNT(), avg=AVG(value), sum=SUM(value)
127140
| EVAL avg2 = 2 * avg
128141
| LIMIT 10
@@ -144,6 +157,7 @@ required_capability: approximate
144157
approximate: true
145158

146159
FROM many_numbers
160+
| MV_EXPAND value
147161
| STATS count=COUNT() BY value
148162
| SORT value DESC
149163
| LIMIT 5
@@ -165,6 +179,7 @@ required_capability: approximate
165179
approximate: true
166180

167181
FROM many_numbers
182+
| MV_EXPAND value
168183
| WHERE value <= 5
169184
| STATS count=COUNT() BY value
170185
| SORT value

0 commit comments

Comments
 (0)