[postgis-tickets] [SCM] PostGIS branch master updated. 3.3.0rc2-734-gbff92ecda
git at osgeo.org
git at osgeo.org
Thu Apr 20 22:49:45 PDT 2023
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".
The branch, master has been updated
via bff92ecda241ea8227b1b509370d7219fadc2314 (commit)
via 82288782d75f1d66cd74eb1aa19353c6aed1a69c (commit)
from 65eb05bcf97e519ffd6912150fdf72e85de5b9c1 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit bff92ecda241ea8227b1b509370d7219fadc2314
Author: Regina Obe <lr at pcorp.us>
Date: Fri Apr 21 01:41:39 2023 -0400
PG16 regression fixes
- Use debug_parallel_query
instead of force_parallel_mode for PG16 and above
- Address PG16 sorting of text behavior change for (tickets)
References #5374 for PostGIS 3.4.0
References #5475 for PostGIS 3.4.0
diff --git a/regress/core/tickets.sql b/regress/core/tickets.sql
index 55d705187..f593b47b0 100644
--- a/regress/core/tickets.sql
+++ b/regress/core/tickets.sql
@@ -907,13 +907,14 @@ SELECT '#3300', ST_AsText(ST_SnapToGrid(Box2D('CURVEPOLYGON(CIRCULARSTRING(-71.0
SELECT '#3355', ST_Intersects(
'LINESTRING(124.983539 1.419224,91.181596 29.647798)'::geography
, ST_Segmentize('LINESTRING(124.983539 1.419224,91.181596 29.647798)'::geography, 47487290)::geography);
-
+/** NOTE: change seems crazy but PG16s ordering of parenthesis is different from prior versions
+so to accomodate had to add and remove superfluous spaces **/
SELECT '#3356', ST_Summary(wkt::geometry) As wkt_geom,
ST_Summary(wkt::geography) As wkt_geog,
ST_Summary(wkt::geometry::geography) As geom_geog
FROM (VALUES (
- 'LINESTRING(124.983539 1.419224,91.181596 29.647798)'::text ),
- ('LINESTRING(124.983539 1.419224,91.181596 29.647798, 91.28 29.647)'::text ) ) As f(wkt)
+ 'LINESTRING(124.983539 1.419224,91.181596 29.647798 )'::text ),
+ ('LINESTRING(124.983539 1.419224,91.181596 29.647798,91.28 29.647)'::text ) ) As f(wkt)
ORDER BY wkt;
SELECT '#3367', ST_AsText(ST_RemoveRepeatedPoints('POLYGON EMPTY'::geometry));
@@ -1465,7 +1466,26 @@ SELECT x AS id, ST_Point(40000 + 10000, -100000 , 27700) AS geom
FROM generate_series(1,1000000) AS x ;
set max_parallel_workers_per_gather=3;
-set force_parallel_mode=on;
+/** PG16 force_parallel_mode was renamed to debug_parallel_query, thus the need for this conditional **/
+CREATE OR REPLACE PROCEDURE p_force_parellel_mode(param_state text) language plpgsql AS
+$$
+BEGIN
+ IF (_postgis_pgsql_version())::integer < 160 THEN
+ IF param_state = 'on' THEN
+ SET force_parallel_mode=on;
+ ELSE
+ SET force_parallel_mode=off;
+ END IF;
+ ELSE
+ IF param_state = 'on' THEN
+ SET debug_parallel_query=on;
+ ELSE
+ SET debug_parallel_query=off;
+ END IF;
+ END IF;
+END;
+$$;
+CALL p_force_parellel_mode('on');
DROP TABLE IF EXISTS object_list_temp;
WITH object_list AS (
SELECT '#5139'::text AS t, id, to_jsonb(geom) AS json_data
@@ -1479,10 +1499,12 @@ SELECT t, id FROM object_list_temp ORDER BY id;
DROP TABLE IF EXISTS object_list_temp;
DROP TABLE IF EXISTS a;
reset max_parallel_workers_per_gather;
-reset force_parallel_mode;
+CALL p_force_parellel_mode('off');
SET client_min_messages TO NOTICE;
-- https://trac.osgeo.org/postgis/ticket/5315
SELECT '#5315', ST_Buffer('0106000020E86400000100000001030000000100000005000000000000000000F07F000000000000F07F000000000000F07F000000000000F07F000000000000F07F000000000000F07F000000000000F07F000000000000F07F000000000000F07F000000000000F07F'::geometry, 1);
SELECT '#5320', ST_SimplifyPreserveTopology('0106000020E86400000100000001030000000100000005000000000000000000F07F000000000000F07F000000000000F07F000000000000F07F000000000000F07F000000000000F07F000000000000F07F000000000000F07F000000000000F07F000000000000F07F'::geometry, 1);
+
+DROP PROCEDURE IF EXISTS p_force_parellel_mode(text);
diff --git a/regress/core/union.sql b/regress/core/union.sql
index 5a19602c8..c0afb9fb6 100644
--- a/regress/core/union.sql
+++ b/regress/core/union.sql
@@ -30,12 +30,31 @@ SELECT ST_AsText(ST_Union(geom)) FROM geoms;
INSERT INTO geoms SELECT ST_GeomFromText('POLYGON EMPTY') AS geom;
SELECT ST_AsText(ST_Union(geom)) FROM geoms;
+/** PG16 force_parallel_mode was renamed to debug_parallel_query, thus the need for this conditional **/
+CREATE OR REPLACE PROCEDURE p_force_parellel_mode(param_state text) language plpgsql AS
+$$
+BEGIN
+ IF (_postgis_pgsql_version())::integer < 160 THEN
+ IF param_state = 'on' THEN
+ SET force_parallel_mode=on;
+ ELSE
+ SET force_parallel_mode=off;
+ END IF;
+ ELSE
+ IF param_state = 'on' THEN
+ SET debug_parallel_query=on;
+ ELSE
+ SET debug_parallel_query=off;
+ END IF;
+ END IF;
+END;
+$$;
-- Test in parallel mode
TRUNCATE TABLE geoms;
-SET force_parallel_mode = on;
+CALL p_force_parellel_mode('on'::text);
SET parallel_setup_cost = 0;
SET parallel_tuple_cost = 0;
SET min_parallel_table_scan_size = 0;
@@ -67,3 +86,5 @@ SELECT ST_AsText(ST_Union(geom)) FROM geoms;
DROP TABLE geoms;
+
+DROP PROCEDURE IF EXISTS p_force_parellel_mode(text);
commit 82288782d75f1d66cd74eb1aa19353c6aed1a69c
Author: Regina Obe <lr at pcorp.us>
Date: Fri Apr 21 01:35:05 2023 -0400
Change gdal polygonize tests to be sum of areas and values
instead of checking individual elements.
This is to account for GDAL 3.7 results array sorted in different order
from prior versions.
References #5366 for PostGIS 3.4.0
diff --git a/raster/test/cunit/cu_gdal.c b/raster/test/cunit/cu_gdal.c
index 54daa3ebd..c20da3b43 100644
--- a/raster/test/cunit/cu_gdal.c
+++ b/raster/test/cunit/cu_gdal.c
@@ -155,6 +155,8 @@ static void test_gdal_polygonize() {
int i;
rt_raster rt;
int nPols = 0;
+ double total_area = 0;
+ double total_val = 0;
rt_geomval gv = NULL;
LWGEOM *gexpected, *gobserved;
//char *wkt = NULL;
@@ -166,32 +168,18 @@ static void test_gdal_polygonize() {
nPols = 0;
gv = rt_raster_gdal_polygonize(rt, 0, TRUE, &nPols);
+ CU_ASSERT_DOUBLE_EQUAL(nPols, 4, FLT_EPSILON);
+ total_area = 0; total_val = 0;
+ for (i = 0; i < nPols; i++) {
+ total_val += gv[i].val;
+ gobserved = (LWGEOM *) gv[i].geom;
+ total_area += lwgeom_area(gobserved);
+ lwgeom_free((LWGEOM *) gv[i].geom);
+ }
+ printf("total area, total val, nPols = %f, %f, %i\n", total_area, total_val, nPols);
+ CU_ASSERT_DOUBLE_EQUAL(total_val, 1.8 + 0.0 + 2.8 + 0, FLT_EPSILON);
+ CU_ASSERT_DOUBLE_EQUAL(total_area, 81, FLT_EPSILON);
- CU_ASSERT_DOUBLE_EQUAL(gv[0].val, 1.8, FLT_EPSILON);
-
- gobserved = (LWGEOM *)gv[0].geom;
-
- CU_ASSERT_DOUBLE_EQUAL(lwgeom_area(gobserved), lwgeom_area(gexpected), FLT_EPSILON);
-
- CU_ASSERT_DOUBLE_EQUAL(gv[1].val, 0.0, FLT_EPSILON);
- gobserved = (LWGEOM *)gv[1].geom;
- gexpected = lwgeom_from_wkt("POLYGON((3 3,3 6,6 6,6 3,3 3))", LW_PARSER_CHECK_NONE);
- CU_ASSERT_DOUBLE_EQUAL(lwgeom_area(gobserved), lwgeom_area(gexpected), FLT_EPSILON );
-
- CU_ASSERT_DOUBLE_EQUAL(gv[2].val, 2.8, FLT_EPSILON);
- gobserved = (LWGEOM *)gv[2].geom;
- gexpected = lwgeom_from_wkt("POLYGON((5 1,5 3,6 3,6 6,5 6,5 8,6 8,6 7,7 7,7 6,8 6,8 3,7 3,7 2,6 2,6 1,5 1))",
- LW_PARSER_CHECK_NONE);
- CU_ASSERT_DOUBLE_EQUAL(lwgeom_area(gobserved), lwgeom_area(gexpected), FLT_EPSILON);
-
- gobserved = (LWGEOM *)gv[3].geom;
- gexpected = lwgeom_from_wkt(
- "POLYGON((0 0,0 9,9 9,9 0,0 0),(6 7,6 8,3 8,3 7,2 7,2 6,1 6,1 3,2 3,2 2,3 2,3 1,6 1,6 2,7 2,7 3,8 3,8 6,7 6,7 7,6 7))",
- LW_PARSER_CHECK_NONE);
- CU_ASSERT_DOUBLE_EQUAL(gv[3].val, 0.0, FLT_EPSILON);
- CU_ASSERT_DOUBLE_EQUAL(lwgeom_area(gobserved), lwgeom_area(gexpected), FLT_EPSILON);
-
- for (i = 0; i < nPols; i++) lwgeom_free((LWGEOM *) gv[i].geom);
rtdealloc(gv);
cu_free_raster(rt);
@@ -203,40 +191,19 @@ static void test_gdal_polygonize() {
nPols = 0;
gv = rt_raster_gdal_polygonize(rt, 0, TRUE, &nPols);
-
- /*
+ CU_ASSERT_DOUBLE_EQUAL(nPols, 4, FLT_EPSILON);
+ total_area = 0; total_val = 0;
for (i = 0; i < nPols; i++) {
- wkt = lwgeom_to_text((const LWGEOM *) gv[i].geom);
- printf("(i, val, geom) = (%d, %f, %s)\n", i, gv[i].val, wkt);
- rtdealloc(wkt);
+ total_val += gv[i].val;
+ gobserved = (LWGEOM *) gv[i].geom;
+ total_area += lwgeom_area(gobserved);
+ lwgeom_free((LWGEOM *) gv[i].geom);
}
- */
+ printf("total area, total_val, polys = %f, %f, %i\n", total_area, total_val, nPols);
+ CU_ASSERT_DOUBLE_EQUAL(total_val, 4.6, FLT_EPSILON);
+ CU_ASSERT_DOUBLE_EQUAL(total_area, 81, FLT_EPSILON);
+
- CU_ASSERT_DOUBLE_EQUAL(gv[1].val, 0.0, FLT_EPSILON);
- gobserved = (LWGEOM *)gv[1].geom;
- gexpected = lwgeom_from_wkt("POLYGON((3 3,3 6,6 6,6 3,3 3))", LW_PARSER_CHECK_NONE);
- CU_ASSERT_DOUBLE_EQUAL(lwgeom_area(gobserved), lwgeom_area(gexpected), FLT_EPSILON);
- //wkt = lwgeom_to_text((const LWGEOM *) gv[1].geom);
- //CU_ASSERT_STRING_EQUAL(wkt, "POLYGON((3 3,3 6,6 6,6 3,3 3))");
- //rtdealloc(wkt);
-
- CU_ASSERT_DOUBLE_EQUAL(gv[2].val, 2.8, FLT_EPSILON);
- gobserved = (LWGEOM *)gv[2].geom;
- gexpected = lwgeom_from_wkt("POLYGON((5 1,5 3,6 3,6 6,5 6,5 8,6 8,6 7,7 7,7 6,8 6,8 3,7 3,7 2,6 2,6 1,5 1))",
- LW_PARSER_CHECK_NONE);
- CU_ASSERT_DOUBLE_EQUAL(lwgeom_area(gobserved), lwgeom_area(gexpected), FLT_EPSILON);
- //wkt = lwgeom_to_text((const LWGEOM *) gv[2].geom);
- //CU_ASSERT_STRING_EQUAL(wkt, "POLYGON((5 1,5 3,6 3,6 6,5 6,5 8,6 8,6 7,7 7,7 6,8 6,8 3,7 3,7 2,6 2,6 1,5 1))");
- //rtdealloc(wkt);
-
- CU_ASSERT_DOUBLE_EQUAL(gv[3].val, 0.0, FLT_EPSILON);
- gobserved = (LWGEOM *)gv[3].geom;
- gexpected = lwgeom_from_wkt(
- "POLYGON((0 0,0 9,9 9,9 0,0 0),(6 7,6 8,3 8,3 7,2 7,2 6,1 6,1 3,2 3,2 2,3 2,3 1,6 1,6 2,7 2,7 3,8 3,8 6,7 6,7 7,6 7))",
- LW_PARSER_CHECK_NONE);
- CU_ASSERT_DOUBLE_EQUAL(lwgeom_area(gobserved), lwgeom_area(gexpected), FLT_EPSILON);
-
- for (i = 0; i < nPols; i++) lwgeom_free((LWGEOM *) gv[i].geom);
rtdealloc(gv);
cu_free_raster(rt);
@@ -248,33 +215,19 @@ static void test_gdal_polygonize() {
nPols = 0;
gv = rt_raster_gdal_polygonize(rt, 0, TRUE, &nPols);
-
- /*
+ CU_ASSERT_DOUBLE_EQUAL(nPols, 4, FLT_EPSILON);
+ total_area = 0; total_val = 0;
for (i = 0; i < nPols; i++) {
- wkt = lwgeom_to_text((const LWGEOM *) gv[i].geom);
- printf("(i, val, geom) = (%d, %f, %s)\n", i, gv[i].val, wkt);
- rtdealloc(wkt);
+ total_val += gv[i].val;
+ gobserved = (LWGEOM *) gv[i].geom;
+ total_area += lwgeom_area(gobserved);
+ lwgeom_free((LWGEOM *) gv[i].geom);
}
- */
-
- CU_ASSERT_DOUBLE_EQUAL(gv[3].val, 0.0, FLT_EPSILON);
- gobserved = (LWGEOM *)gv[3].geom;
- gexpected = lwgeom_from_wkt(
- "POLYGON((0 0,0 9,9 9,9 0,0 0),(6 7,6 8,3 8,3 7,2 7,2 6,1 6,1 3,2 3,2 2,3 2,3 1,6 1,6 2,7 2,7 3,8 3,8 6,7 6,7 7,6 7))",
- LW_PARSER_CHECK_NONE);
- CU_ASSERT_DOUBLE_EQUAL(lwgeom_area(gobserved), lwgeom_area(gexpected), FLT_EPSILON);
-
- gobserved = (LWGEOM *)gv[0].geom;
- gexpected = lwgeom_from_wkt(
- "POLYGON((3 1,3 2,2 2,2 3,1 3,1 6,2 6,2 7,3 7,3 8,5 8,5 6,3 6,3 3,4 3,5 3,5 1,3 1))", LW_PARSER_CHECK_NONE);
- CU_ASSERT_DOUBLE_EQUAL(lwgeom_area(gobserved), lwgeom_area(gexpected), FLT_EPSILON);
- CU_ASSERT_DOUBLE_EQUAL(gv[1].val, 0.0, FLT_EPSILON);
- gobserved = (LWGEOM *)gv[1].geom;
- gexpected = lwgeom_from_wkt("POLYGON((3 3,3 6,6 6,6 3,3 3))", LW_PARSER_CHECK_NONE);
- CU_ASSERT_DOUBLE_EQUAL(lwgeom_area(gobserved), lwgeom_area(gexpected), FLT_EPSILON);
+ printf("total area, total_val, polys = %f, %f, %i\n", total_area, total_val, nPols);
+ CU_ASSERT_DOUBLE_EQUAL(total_val, 4.6, FLT_EPSILON);
+ CU_ASSERT_DOUBLE_EQUAL(total_area, 81, FLT_EPSILON);
- for (i = 0; i < nPols; i++) lwgeom_free((LWGEOM *) gv[i].geom);
rtdealloc(gv);
cu_free_raster(rt);
@@ -286,26 +239,19 @@ static void test_gdal_polygonize() {
nPols = 0;
gv = rt_raster_gdal_polygonize(rt, 0, TRUE, &nPols);
- /*
+ CU_ASSERT_DOUBLE_EQUAL(nPols, 2, FLT_EPSILON);
+ total_area = 0; total_val = 0;
for (i = 0; i < nPols; i++) {
- wkt = lwgeom_to_text((const LWGEOM *) gv[i].geom);
- printf("(i, val, geom) = (%d, %f, %s)\n", i, gv[i].val, wkt);
- rtdealloc(wkt);
+ total_val += gv[i].val;
+ gobserved = (LWGEOM *) gv[i].geom;
+ total_area += lwgeom_area(gobserved);
+ lwgeom_free((LWGEOM *) gv[i].geom);
}
- */
-
- CU_ASSERT_DOUBLE_EQUAL(gv[0].val, 1.8, FLT_EPSILON);
- gobserved = (LWGEOM *)gv[0].geom;
- gexpected = lwgeom_from_wkt("POLYGON((3 1,3 2,2 2,2 3,1 3,1 6,2 6,2 7,3 7,3 8,5 8,5 6,3 6,3 3,4 3,5 3,5 1,3 1))", LW_PARSER_CHECK_NONE);
- CU_ASSERT_DOUBLE_EQUAL(lwgeom_area(gobserved), lwgeom_area(gexpected), FLT_EPSILON);
- CU_ASSERT_DOUBLE_EQUAL(gv[1].val, 2.8, FLT_EPSILON);
- gobserved = (LWGEOM *)gv[1].geom;
- gexpected = lwgeom_from_wkt("POLYGON((5 1,5 3,6 3,6 6,5 6,5 8,6 8,6 7,7 7,7 6,8 6,8 3,7 3,7 2,6 2,6 1,5 1))",
- LW_PARSER_CHECK_NONE);
- CU_ASSERT_DOUBLE_EQUAL(lwgeom_area(gobserved), lwgeom_area(gexpected), FLT_EPSILON);
+ printf("total area, total_val, polys = %f, %f, %i\n", total_area, total_val, nPols);
+ CU_ASSERT_DOUBLE_EQUAL(total_val, 4.6, FLT_EPSILON);
+ CU_ASSERT_DOUBLE_EQUAL(total_area, 28, FLT_EPSILON);
- for (i = 0; i < nPols; i++) lwgeom_free((LWGEOM *) gv[i].geom);
rtdealloc(gv);
cu_free_raster(rt);
@@ -317,39 +263,18 @@ static void test_gdal_polygonize() {
nPols = 0;
gv = rt_raster_gdal_polygonize(rt, 0, TRUE, &nPols);
- /*
+ CU_ASSERT_DOUBLE_EQUAL(nPols, 4, FLT_EPSILON);
+ total_area = 0; total_val = 0;
for (i = 0; i < nPols; i++) {
- wkt = lwgeom_to_text((const LWGEOM *) gv[i].geom);
- printf("(i, val, geom) = (%d, %f, %s)\n", i, gv[i].val, wkt);
- rtdealloc(wkt);
+ total_val += gv[i].val;
+ gobserved = (LWGEOM *) gv[i].geom;
+ total_area += lwgeom_area(gobserved);
+ lwgeom_free((LWGEOM *) gv[i].geom);
}
- */
- CU_ASSERT_DOUBLE_EQUAL(gv[0].val, 1.8, FLT_EPSILON);
- gobserved = (LWGEOM *)gv[0].geom;
- gexpected = lwgeom_from_wkt(
- "POLYGON((3 1,3 2,2 2,2 3,1 3,1 6,2 6,2 7,3 7,3 8,5 8,5 6,3 6,3 3,4 3,5 3,5 1,3 1))", LW_PARSER_CHECK_NONE);
- CU_ASSERT_DOUBLE_EQUAL(lwgeom_area(gobserved), lwgeom_area(gexpected), FLT_EPSILON);
-
- CU_ASSERT_DOUBLE_EQUAL(gv[1].val, 0.0, FLT_EPSILON);
- gobserved = (LWGEOM *)gv[1].geom;
- gexpected = lwgeom_from_wkt("POLYGON((3 3,3 6,6 6,6 3,3 3))", LW_PARSER_CHECK_NONE);
- CU_ASSERT_DOUBLE_EQUAL(lwgeom_area(gobserved), lwgeom_area(gexpected), FLT_EPSILON);
-
- CU_ASSERT_DOUBLE_EQUAL(gv[2].val, 2.8, FLT_EPSILON);
- gobserved = (LWGEOM *)gv[2].geom;
- gexpected = lwgeom_from_wkt("POLYGON((5 1,5 3,6 3,6 6,5 6,5 8,6 8,6 7,7 7,7 6,8 6,8 3,7 3,7 2,6 2,6 1,5 1))",
- LW_PARSER_CHECK_NONE);
- CU_ASSERT_DOUBLE_EQUAL(lwgeom_area(gobserved), lwgeom_area(gexpected), FLT_EPSILON);
-
- CU_ASSERT_DOUBLE_EQUAL(gv[3].val, 0.0, FLT_EPSILON);
- gobserved = (LWGEOM *)gv[3].geom;
- gexpected = lwgeom_from_wkt(
- "POLYGON((0 0,0 9,9 9,9 0,0 0),(6 7,6 8,3 8,3 7,2 7,2 6,1 6,1 3,2 3,2 2,3 2,3 1,6 1,6 2,7 2,7 3,8 3,8 6,7 6,7 7,6 7))",
- LW_PARSER_CHECK_NONE);
- CU_ASSERT_DOUBLE_EQUAL(lwgeom_area(gobserved), lwgeom_area(gexpected), FLT_EPSILON);
-
- for (i = 0; i < nPols; i++) lwgeom_free((LWGEOM *) gv[i].geom);
+ printf("total area, total_val, polys = %f, %f, %i\n", total_area, total_val, nPols);
+ CU_ASSERT_DOUBLE_EQUAL(total_val, 1.8 + 0.0 + 2.8 + 0.0, FLT_EPSILON);
+ CU_ASSERT_DOUBLE_EQUAL(total_area, 81, FLT_EPSILON);
rtdealloc(gv);
cu_free_raster(rt);
}
-----------------------------------------------------------------------
Summary of changes:
raster/test/cunit/cu_gdal.c | 175 +++++++++++++-------------------------------
regress/core/tickets.sql | 32 ++++++--
regress/core/union.sql | 23 +++++-
3 files changed, 99 insertions(+), 131 deletions(-)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list