Merge pull request #214 from CartoDB/211-boolean-col-overviews
Support boolean columns when creating overviews
This commit is contained in:
@@ -486,6 +486,8 @@ BEGIN
|
|||||||
-- Using 'string_agg(' || qualified_column || ',''/'')'
|
-- Using 'string_agg(' || qualified_column || ',''/'')'
|
||||||
-- here causes
|
-- here causes
|
||||||
RETURN 'CASE count(*) WHEN 1 THEN MIN(' || qualified_column || ') ELSE NULL END::' || column_type;
|
RETURN 'CASE count(*) WHEN 1 THEN MIN(' || qualified_column || ') ELSE NULL END::' || column_type;
|
||||||
|
WHEN 'boolean' THEN
|
||||||
|
RETURN 'CASE count(*) WHEN 1 THEN BOOL_AND(' || qualified_column || ') ELSE NULL END::' || column_type;
|
||||||
ELSE
|
ELSE
|
||||||
RETURN 'CASE count(*) WHEN 1 THEN MIN(' || qualified_column || ') ELSE NULL END::' || column_type;
|
RETURN 'CASE count(*) WHEN 1 THEN MIN(' || qualified_column || ') ELSE NULL END::' || column_type;
|
||||||
END CASE;
|
END CASE;
|
||||||
|
|||||||
@@ -20,14 +20,19 @@ SELECT count(*) FROM _vovw_5_base_t;
|
|||||||
|
|
||||||
SELECT CDB_CreateOverviews('polyg_t'::regclass);
|
SELECT CDB_CreateOverviews('polyg_t'::regclass);
|
||||||
|
|
||||||
|
SELECT CDB_CreateOverviews('column_types_t'::regclass);
|
||||||
|
|
||||||
SELECT CDB_Overviews('base_t'::regclass);
|
SELECT CDB_Overviews('base_t'::regclass);
|
||||||
SELECT CDB_Overviews(ARRAY['base_t'::regclass, 'base_bare_t'::regclass]);
|
SELECT CDB_Overviews(ARRAY['base_t'::regclass, 'base_bare_t'::regclass]);
|
||||||
SELECT CDB_Overviews('polyg_t'::regclass);
|
SELECT CDB_Overviews('polyg_t'::regclass);
|
||||||
|
SELECT CDB_Overviews('column_types_t'::regclass);
|
||||||
|
|
||||||
|
SELECT CDB_DropOverviews('column_types_t'::regclass);
|
||||||
SELECT CDB_DropOverviews('base_bare_t'::regclass);
|
SELECT CDB_DropOverviews('base_bare_t'::regclass);
|
||||||
SELECT CDB_DropOverviews('base_t'::regclass);
|
SELECT CDB_DropOverviews('base_t'::regclass);
|
||||||
SELECT count(*) FROM _vovw_5_base_t;
|
SELECT count(*) FROM _vovw_5_base_t;
|
||||||
|
|
||||||
|
DROP TABLE column_types_t;
|
||||||
DROP TABLE base_bare_t;
|
DROP TABLE base_bare_t;
|
||||||
DROP TABLE base_t;
|
DROP TABLE base_t;
|
||||||
DROP TABLE polyg_t;
|
DROP TABLE polyg_t;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ CREATE TABLE
|
|||||||
INSERT 0 1114
|
INSERT 0 1114
|
||||||
CREATE TABLE
|
CREATE TABLE
|
||||||
INSERT 0 5
|
INSERT 0 5
|
||||||
|
SELECT 1114
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -16,6 +17,7 @@ AVG(tab.number)::double precision AS number,AVG(tab.int_number)::integer AS int_
|
|||||||
{_vovw_5_base_t,_vovw_4_base_t,_vovw_3_base_t,_vovw_2_base_t,_vovw_1_base_t,_vovw_0_base_t}
|
{_vovw_5_base_t,_vovw_4_base_t,_vovw_3_base_t,_vovw_2_base_t,_vovw_1_base_t,_vovw_0_base_t}
|
||||||
125
|
125
|
||||||
|
|
||||||
|
{_vovw_5_column_types_t,_vovw_4_column_types_t,_vovw_3_column_types_t,_vovw_2_column_types_t,_vovw_1_column_types_t,_vovw_0_column_types_t}
|
||||||
(base_t,0,_vovw_0_base_t)
|
(base_t,0,_vovw_0_base_t)
|
||||||
(base_t,1,_vovw_1_base_t)
|
(base_t,1,_vovw_1_base_t)
|
||||||
(base_t,2,_vovw_2_base_t)
|
(base_t,2,_vovw_2_base_t)
|
||||||
@@ -34,6 +36,13 @@ AVG(tab.number)::double precision AS number,AVG(tab.int_number)::integer AS int_
|
|||||||
(base_t,3,_vovw_3_base_t)
|
(base_t,3,_vovw_3_base_t)
|
||||||
(base_t,4,_vovw_4_base_t)
|
(base_t,4,_vovw_4_base_t)
|
||||||
(base_t,5,_vovw_5_base_t)
|
(base_t,5,_vovw_5_base_t)
|
||||||
|
(column_types_t,0,_vovw_0_column_types_t)
|
||||||
|
(column_types_t,1,_vovw_1_column_types_t)
|
||||||
|
(column_types_t,2,_vovw_2_column_types_t)
|
||||||
|
(column_types_t,3,_vovw_3_column_types_t)
|
||||||
|
(column_types_t,4,_vovw_4_column_types_t)
|
||||||
|
(column_types_t,5,_vovw_5_column_types_t)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ERROR: relation "_vovw_5_base_t" does not exist
|
ERROR: relation "_vovw_5_base_t" does not exist
|
||||||
@@ -42,3 +51,4 @@ LINE 1: SELECT count(*) FROM _vovw_5_base_t;
|
|||||||
DROP TABLE
|
DROP TABLE
|
||||||
DROP TABLE
|
DROP TABLE
|
||||||
DROP TABLE
|
DROP TABLE
|
||||||
|
DROP TABLE
|
||||||
|
|||||||
@@ -2240,3 +2240,10 @@ INSERT INTO polyg_t VALUES
|
|||||||
(3, 'C', 'SRID=4326;POLYGON((9 40,8 39,8.5 40,9 41,9 40))'::geometry, ST_Transform('SRID=4326;POLYGON((9 40,8 39,8.5 40,9 41,9 40))'::geometry, 3857)),
|
(3, 'C', 'SRID=4326;POLYGON((9 40,8 39,8.5 40,9 41,9 40))'::geometry, ST_Transform('SRID=4326;POLYGON((9 40,8 39,8.5 40,9 41,9 40))'::geometry, 3857)),
|
||||||
(4, 'D', 'SRID=4326;POLYGON((9 40,8 39,8.5 40,9 41,9 40))'::geometry, ST_Transform('SRID=4326;POLYGON((9 40,8 39,8.5 40,9 41,9 40))'::geometry, 3857)),
|
(4, 'D', 'SRID=4326;POLYGON((9 40,8 39,8.5 40,9 41,9 40))'::geometry, ST_Transform('SRID=4326;POLYGON((9 40,8 39,8.5 40,9 41,9 40))'::geometry, 3857)),
|
||||||
(5, 'E', 'SRID=4326;POLYGON((9 40,8 39,8.5 40,9 41,9 40))'::geometry, ST_Transform('SRID=4326;POLYGON((9 40,8 39,8.5 40,9 41,9 40))'::geometry, 3857));
|
(5, 'E', 'SRID=4326;POLYGON((9 40,8 39,8.5 40,9 41,9 40))'::geometry, ST_Transform('SRID=4326;POLYGON((9 40,8 39,8.5 40,9 41,9 40))'::geometry, 3857));
|
||||||
|
|
||||||
|
CREATE TABLE column_types_t
|
||||||
|
AS SELECT cartodb_id,
|
||||||
|
the_geom,
|
||||||
|
the_geom_webmercator,
|
||||||
|
(CASE cartodb_id % 2 WHEN 0 THEN 'f' ELSE 't' END)::boolean AS is_odd
|
||||||
|
FROM base_bare_t;
|
||||||
|
|||||||
Reference in New Issue
Block a user