Include and aggregate _vovw_count column to count aggregated features

This commit is contained in:
Carla Iriberri 2016-04-12 11:10:55 +02:00
parent e68d5eca45
commit 16d08ef52b

View File

@ -510,7 +510,11 @@ BEGIN
CASE column_type CASE column_type
WHEN 'double precision', 'real', 'integer', 'bigint' THEN WHEN 'double precision', 'real', 'integer', 'bigint' THEN
IF column_name = '_vovw_count' THEN
RETURN 'SUM(_vovw_count)';
ELSE
RETURN Format('AVG(%s)::' || column_type, qualified_column); RETURN Format('AVG(%s)::' || column_type, qualified_column);
END IF;
WHEN 'text' THEN WHEN 'text' THEN
-- TODO: we could define a new aggregate function that returns distinct -- TODO: we could define a new aggregate function that returns distinct
-- separated values with a limit, adding ellipsis if more values existed -- separated values with a limit, adding ellipsis if more values existed
@ -648,6 +652,10 @@ AS $$
SELECT * FROM cols SELECT * FROM cols
) AS s INTO columns; ) AS s INTO columns;
IF NOT columns LIKE '%_vovw_count%' THEN
columns := columns || ', n AS _vovw_count';
END IF;
EXECUTE Format('DROP TABLE IF EXISTS %I.%I CASCADE;', schema_name, overview_rel); EXECUTE Format('DROP TABLE IF EXISTS %I.%I CASCADE;', schema_name, overview_rel);
-- Now we cluster the data using a grid of size grid_m -- Now we cluster the data using a grid of size grid_m