Test behavior of binning fuctions with nulls
All test results are based off of existing behavior, which doesn't always make sense (ref #247)
This commit is contained in:
parent
8f1435c049
commit
3122a0479d
@ -2,4 +2,10 @@ WITH data AS (
|
||||
SELECT array_agg(x::numeric) s FROM generate_series(1,300) x
|
||||
WHERE x % 5 != 0 AND x % 7 != 0
|
||||
)
|
||||
SELECT round(unnest(CDB_EqualIntervalBins(s, 7)),7) FROM data
|
||||
SELECT round(unnest(CDB_EqualIntervalBins(s, 7)),7) FROM data;
|
||||
|
||||
WITH data_nulls AS (
|
||||
SELECT array_agg(CASE WHEN x % 2 != 0 THEN x ELSE NULL END::numeric) s FROM generate_series(1,100) x
|
||||
WHERE x % 5 != 0 AND x % 7 != 0
|
||||
)
|
||||
SELECT round(unnest(CDB_EqualIntervalBins(s, 7)),7) FROM data_nulls;
|
||||
|
@ -5,3 +5,10 @@
|
||||
213.8571429
|
||||
256.4285714
|
||||
299.0000000
|
||||
15.0000000
|
||||
29.0000000
|
||||
43.0000000
|
||||
57.0000000
|
||||
71.0000000
|
||||
85.0000000
|
||||
99.0000000
|
||||
|
@ -1,5 +1,11 @@
|
||||
WITH data AS (
|
||||
SELECT array_agg(x) x FROM generate_series(1,100) x
|
||||
SELECT array_agg(x::numeric) s FROM generate_series(1,100) x
|
||||
WHERE x % 5 != 0 AND x % 7 != 0
|
||||
)
|
||||
SELECT round(unnest(CDB_HeadsTailsBins(x, 7)),2) FROM data
|
||||
SELECT round(unnest(CDB_HeadsTailsBins(s, 7)),2) FROM data;
|
||||
|
||||
WITH data_nulls AS (
|
||||
SELECT array_agg(CASE WHEN x % 2 != 0 THEN x ELSE NULL END::numeric) s FROM generate_series(1,100) x
|
||||
WHERE x % 5 != 0 AND x % 7 != 0
|
||||
)
|
||||
SELECT round(unnest(CDB_HeadsTailsBins(s, 7)),2) FROM data_nulls;
|
||||
|
@ -5,3 +5,9 @@
|
||||
96.50
|
||||
98.00
|
||||
99.00
|
||||
49.76
|
||||
74.65
|
||||
88.50
|
||||
94.50
|
||||
98.00
|
||||
99.00
|
||||
|
@ -1,5 +1,11 @@
|
||||
WITH data AS (
|
||||
SELECT array_agg(x) x FROM generate_series(1,100) x
|
||||
SELECT array_agg(x::numeric) s FROM generate_series(1,300) x
|
||||
WHERE x % 5 != 0 AND x % 7 != 0
|
||||
)
|
||||
SELECT unnest(CDB_JenksBins(x, 7)) FROM data
|
||||
SELECT unnest(CDB_JenksBins(s, 7)) FROM data;
|
||||
|
||||
WITH data_nulls AS (
|
||||
SELECT array_agg(CASE WHEN x % 2 != 0 THEN x ELSE NULL END::numeric) s FROM generate_series(1,300) x
|
||||
WHERE x % 5 != 0 AND x % 7 != 0
|
||||
)
|
||||
SELECT unnest(CDB_JenksBins(s, 7)) FROM data_nulls;
|
||||
|
@ -1,7 +1,14 @@
|
||||
13
|
||||
29
|
||||
43
|
||||
57
|
||||
71
|
||||
83
|
||||
99
|
||||
86
|
||||
129
|
||||
172
|
||||
213
|
||||
257
|
||||
299
|
||||
37
|
||||
51
|
||||
97
|
||||
157
|
||||
213
|
||||
241
|
||||
|
||||
|
@ -1,5 +1,11 @@
|
||||
WITH data AS (
|
||||
SELECT array_agg(x) x FROM generate_series(1,100) x
|
||||
SELECT array_agg(x::numeric) s FROM generate_series(1,100) x
|
||||
WHERE x % 5 != 0 AND x % 7 != 0
|
||||
)
|
||||
SELECT unnest(CDB_QuantileBins(x, 7)) FROM data
|
||||
SELECT unnest(CDB_QuantileBins(s, 7)) FROM data;
|
||||
|
||||
WITH data_nulls AS (
|
||||
SELECT array_agg(CASE WHEN x % 2 != 0 THEN x ELSE NULL END::numeric) s FROM generate_series(1,100) x
|
||||
WHERE x % 5 != 0 AND x % 7 != 0
|
||||
)
|
||||
SELECT unnest(CDB_QuantileBins(s, 7)) FROM data_nulls;
|
||||
|
@ -4,4 +4,11 @@
|
||||
57
|
||||
71
|
||||
86
|
||||
99
|
||||
29
|
||||
57
|
||||
87
|
||||
|
||||
|
||||
|
||||
99
|
||||
|
Loading…
Reference in New Issue
Block a user