Merge pull request #145 from CartoDB/fix-cdb_stats-test
Do not use random() for the distribution to test CDB_Stats functions
This commit is contained in:
commit
d67f097703
@ -2,15 +2,12 @@
|
|||||||
-- http://mathworld.wolfram.com/UniformDistribution.html
|
-- http://mathworld.wolfram.com/UniformDistribution.html
|
||||||
set client_min_messages to ERROR;
|
set client_min_messages to ERROR;
|
||||||
|
|
||||||
With dist As (
|
WITH dist AS (
|
||||||
SELECT random()::numeric As val
|
SELECT generate_series(0,10000)::numeric / 10000.0 i
|
||||||
FROM generate_series(1,50000) t
|
|
||||||
)
|
)
|
||||||
|
SELECT
|
||||||
SELECT
|
abs(CDB_Kurtosis(array_agg(i)) + 1.2) < 1e-3 AS kurtosis,
|
||||||
-- does random dist values match within 1% of known values
|
abs(CDB_Skewness(array_agg(i))) < 1e-3 AS skewness
|
||||||
abs(CDB_Kurtosis(array_agg(val)) + 1.20) < 1e-2 As kurtosis,
|
|
||||||
abs(CDB_Skewness(array_agg(val)) - 0) < 1e-2 As skewness
|
|
||||||
FROM dist;
|
FROM dist;
|
||||||
|
|
||||||
set client_min_messages to NOTICE;
|
set client_min_messages to NOTICE;
|
||||||
|
Loading…
Reference in New Issue
Block a user