cartodb-postgresql/test/CDB_QuantileBinsTest.sql

18 lines
428 B
MySQL
Raw Normal View History

WITH data AS (
SELECT array_agg(x::numeric) AS s
FROM generate_series(0, 99) AS x
)
SELECT unnest(CDB_QuantileBins(s, 10))
FROM data;
WITH data_nulls AS (
2017-12-06 05:24:11 +08:00
SELECT array_agg(x::numeric) AS s
FROM (
SELECT x FROM generate_series(0, 99) AS x
UNION ALL
2017-12-06 05:24:11 +08:00
SELECT null AS x FROM generate_series(1, 10) AS x
) _wrap
)
SELECT unnest(CDB_QuantileBins(s, 10))
FROM data_nulls;