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
1016approximate: true
1117
1218FROM 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
2734approximate: true
2835
2936FROM 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
4149approximate: true
4250
4351FROM 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
5968approximate: true
6069
6170FROM 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
7888approximate: true
7989
8090FROM 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
96107approximate: true
97108
98109FROM 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
123135approximate: true
124136
125137FROM 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
144157approximate: true
145158
146159FROM 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
165179approximate: true
166180
167181FROM many_numbers
182+ | MV_EXPAND value
168183 | WHERE value <= 5
169184 | STATS count=COUNT() BY value
170185 | SORT value
0 commit comments