2014-05-06 00:48:48 +08:00
|
|
|
WITH data AS (
|
2017-12-06 21:10:09 +08:00
|
|
|
SELECT Array[0.99, 1.0, 1.01,
|
|
|
|
4.99, 5.01,
|
|
|
|
10.01, 10.01,
|
|
|
|
15.01, 14.99,
|
|
|
|
20.1, 19.9]::numeric[] AS s
|
|
|
|
)
|
2018-09-10 19:16:25 +08:00
|
|
|
SELECT unnest(CDB_JenksBins(s, 5)) FROM data;
|
|
|
|
|
2016-04-29 00:50:09 +08:00
|
|
|
|
|
|
|
WITH data_nulls AS (
|
2017-12-06 21:10:09 +08:00
|
|
|
SELECT Array[0.99, 1.0, 1.01,
|
|
|
|
4.99, 5.01,
|
|
|
|
null, null,
|
|
|
|
10.01, 10.01,
|
|
|
|
15.01, 14.99,
|
|
|
|
null, null,
|
|
|
|
20.1, 19.9]::numeric[] AS s
|
|
|
|
)
|
2018-09-10 21:42:54 +08:00
|
|
|
SELECT unnest(CDB_JenksBins(s, 5)) FROM data_nulls;
|
|
|
|
|
|
|
|
|
|
|
|
WITH data_inverse AS (
|
|
|
|
SELECT Array[0.99, 1.0, 1.01,
|
|
|
|
4.99, 5.01,
|
|
|
|
10.01, 10.01,
|
|
|
|
15.01, 14.99,
|
|
|
|
20.1, 19.9]::numeric[] AS s
|
|
|
|
)
|
|
|
|
SELECT unnest(CDB_JenksBins(s, 5, 0, true)) FROM data_inverse;
|