-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3515244
commit 87c240d
Showing
6 changed files
with
1,064 additions
and
116 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Original Update Tests | ||
This file is a port of the original hardcoded update-tester tests to markdown, similar to how sql-doctester works. | ||
|
||
These markdown files are parsed in the same way as sql-doctester would with the addition of two fields: `creation` and `validation`. (Names are not final). | ||
|
||
Tests marked `creation` will be ran during the object creation step, tests marked validation will be ran during the validation step. | ||
|
||
|
||
|
||
## Object Creation Step | ||
|
||
Currently, `SET TIME ZONE 'UTC';` will cause tests to fail if used in the `validation` step, so it should used in `creation` if needed. | ||
```sql,creation,min-toolkit-version=1.4.0 | ||
SET TIME ZONE 'UTC'; | ||
CREATE TABLE test_data(ts timestamptz, val DOUBLE PRECISION); | ||
INSERT INTO test_data | ||
SELECT '2020-01-01 00:00:00+00'::timestamptz + i * '1 hour'::interval, | ||
100 + i % 100 | ||
FROM generate_series(0, 10000) i; | ||
CREATE MATERIALIZED VIEW regression_view AS | ||
SELECT | ||
counter_agg(ts, val) AS countagg, | ||
hyperloglog(1024, val) AS hll, | ||
time_weight('locf', ts, val) AS twa, | ||
uddsketch(100, 0.001, val) as udd, | ||
tdigest(100, val) as tdig, | ||
stats_agg(val) as stats | ||
FROM test_data; | ||
``` | ||
## Validation Step | ||
```sql,validation,min-toolkit-version=1.4.0 | ||
SELECT | ||
num_resets(countagg), | ||
distinct_count(hll), | ||
average(twa), | ||
approx_percentile(0.1, udd), | ||
approx_percentile(0.1, tdig), | ||
kurtosis(stats) | ||
FROM regression_view; | ||
``` | ||
|
||
```output | ||
num_resets | distinct_count | average | approx_percentile | approx_percentile | kurtosis | ||
------------+----------------+---------+--------------------+--------------------+-------------------- | ||
100 | 100 | 149.5 | 108.96220333142547 | 109.50489521100047 | 1.7995661075080858 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.