1
1
// 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
+ //
2
8
// Note: this tests only basic behavior, because of limitations of the CSV tests.
3
9
// Most tests assert that the count, average and sum of some values are within a
4
10
// range. All ranges are very loose, so that the tests should practically never fail.
@@ -10,6 +16,7 @@ required_capability: approximate
10
16
approximate: true
11
17
12
18
FROM many_numbers
19
+ | MV_EXPAND value
13
20
| STATS count=COUNT(), avg=AVG(value), sum=SUM(value)
14
21
| EVAL is_expected = count >= 450000 AND count <= 550000 AND
15
22
avg >= 600 AND avg <= 750 AND
@@ -27,6 +34,7 @@ required_capability: approximate
27
34
approximate: true
28
35
29
36
FROM many_numbers
37
+ | MV_EXPAND value
30
38
| WHERE value <= 25
31
39
| STATS count=COUNT(), avg=AVG(value), sum=SUM(value)
32
40
;
@@ -41,6 +49,7 @@ required_capability: approximate
41
49
approximate: true
42
50
43
51
FROM many_numbers
52
+ | MV_EXPAND value
44
53
| WHERE value >= 500
45
54
| STATS count=COUNT(), avg=AVG(value), sum=SUM(value)
46
55
| EVAL is_expected = count >= 300000 AND count <= 450000 AND
@@ -59,6 +68,7 @@ required_capability: approximate
59
68
approximate: true
60
69
61
70
FROM many_numbers
71
+ | MV_EXPAND value
62
72
| STATS count=COUNT() WHERE value >= 500,
63
73
avg=AVG(value) WHERE value >= 500,
64
74
sum=SUM(value) WHERE value >= 500
@@ -78,6 +88,7 @@ required_capability: approximate
78
88
approximate: true
79
89
80
90
FROM many_numbers
91
+ | MV_EXPAND value
81
92
| SAMPLE 0.5
82
93
| STATS count=COUNT(), avg=AVG(value), sum=SUM(value)
83
94
| EVAL is_expected = count >= 200000 AND count <= 300000 AND
@@ -96,6 +107,7 @@ required_capability: approximate
96
107
approximate: true
97
108
98
109
FROM many_numbers
110
+ | MV_EXPAND value
99
111
| EVAL value2 = 2 * value
100
112
| DROP value
101
113
| SORT value2 DESC
@@ -123,6 +135,7 @@ required_capability: approximate
123
135
approximate: true
124
136
125
137
FROM many_numbers
138
+ | MV_EXPAND value
126
139
| STATS count=COUNT(), avg=AVG(value), sum=SUM(value)
127
140
| EVAL avg2 = 2 * avg
128
141
| LIMIT 10
@@ -144,6 +157,7 @@ required_capability: approximate
144
157
approximate: true
145
158
146
159
FROM many_numbers
160
+ | MV_EXPAND value
147
161
| STATS count=COUNT() BY value
148
162
| SORT value DESC
149
163
| LIMIT 5
@@ -165,6 +179,7 @@ required_capability: approximate
165
179
approximate: true
166
180
167
181
FROM many_numbers
182
+ | MV_EXPAND value
168
183
| WHERE value <= 5
169
184
| STATS count=COUNT() BY value
170
185
| SORT value
0 commit comments