mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-30 19:42:00 +00:00
c23c7e0b6f
* feat: add DDSketch quantile * Fix StyleCheck * Move quantileddsketch.md under right dir * Update stateless test number and add stateful test * Throw exception when relative accuracy is too low * Update test number * Fix undefined behaviour for empty store * Fix quantileGK test * Update test numbers * Update src/AggregateFunctions/ * Throw exception on out of range values * Update relative accuracy docs and add encoding details * Address review comments and suggestions * Remove unused function * Address alexey review comments * Remove unused function isFloat64FieldType * Throw error on invalid relative accuracy * Simplify mapping * Address remaining review comments * Add effective memory usage suggestions * Fix Stylecheck * Fix fast test * Incorporate bins capacity suggestion * Fix fuzzer * Remove inheritance in Mapping, Store and DDSketch * Add checks for bin resizing * Add note about the binary compatible implementation
17 lines
1.8 KiB
SQL
17 lines
1.8 KiB
SQL
SELECT quantiles(0.5)(x) FROM (SELECT number AS x FROM system.numbers LIMIT 1001);
|
|
SELECT quantilesExact(0.5)(x) FROM (SELECT number AS x FROM system.numbers LIMIT 1001);
|
|
SELECT quantilesTDigest(0.5)(x) FROM (SELECT number AS x FROM system.numbers LIMIT 1001);
|
|
SELECT quantilesDeterministic(0.5)(x, x) FROM (SELECT number AS x FROM system.numbers LIMIT 1001);
|
|
SELECT arrayMap(a -> round(a, 2), quantilesDDSketch(0.01, 0.5)(x)) FROM (SELECT number AS x FROM system.numbers LIMIT 1001);
|
|
|
|
SELECT quantiles(0, 0.001, 0.01, 0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.95, 0.99, 0.999, 1)(x) FROM (SELECT number AS x FROM system.numbers LIMIT 1001);
|
|
SELECT quantilesExact(0, 0.001, 0.01, 0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.95, 0.99, 0.999, 1)(x) FROM (SELECT number AS x FROM system.numbers LIMIT 1001);
|
|
SELECT quantilesTDigest(0, 0.001, 0.01, 0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.95, 0.99, 0.999, 1)(x) FROM (SELECT number AS x FROM system.numbers LIMIT 1001);
|
|
SELECT quantilesDeterministic(0, 0.001, 0.01, 0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.95, 0.99, 0.999, 1)(x, x) FROM (SELECT number AS x FROM system.numbers LIMIT 1001);
|
|
SELECT arrayMap(a -> round(a, 2), quantilesDDSketch(0.01, 0, 0.001, 0.01, 0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0.95, 0.99, 0.999, 1)(x)) FROM (SELECT number AS x FROM system.numbers LIMIT 1001);
|
|
|
|
-- The result slightly differs but it's ok since `quantilesDeterministic` is an approximate function.
|
|
SET max_bytes_before_external_group_by = 0;
|
|
|
|
SELECT round(1000000 / (number + 1)) AS k, count() AS c, arrayMap(x -> round(x, 6), quantilesDeterministic(0.1, 0.5, 0.9)(number, intHash64(number))) AS q1, quantilesExact(0.1, 0.5, 0.9)(number) AS q2 FROM (SELECT number FROM system.numbers LIMIT 1000000) GROUP BY k ORDER BY k;
|