Skip to content

Commit aada4e2

Browse files
author
Alexey Botchkov
committed
MDEV-31499 Assertion `(0)' failed in Gis_geometry_collection::init_from_opresult.
Calculate prev_range when the polygon's border is met. Otherwise we can falsely mark polygon as a 'hole' which breaks the topology of the result.
1 parent 13047cd commit aada4e2

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

mysql-test/main/gis-precise.result

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -860,3 +860,13 @@ TRUNCATE(ST_Distance_Sphere(@zenica, @sarajevo), 10)
860860
SELECT TRUNCATE(ST_Distance_Sphere(@sarajevo, @zenica), 10);
861861
TRUNCATE(ST_Distance_Sphere(@sarajevo, @zenica), 10)
862862
55878.5933759170
863+
#
864+
# MDEV-31499 Assertion `(0)' failed in Gis_geometry_collection::init_from_opresult.
865+
#
866+
SELECT ST_NUMGEOMETRIES(
867+
ST_INTERSECTION(
868+
ST_MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3.8571428571428568 2.857142857142857,5.571428571428571 4.571428571428571,9 4,3.8571428571428568 2.857142857142857)),((4.5 4.75,3 5,4.6 7.4,6 6,4.5 4.75))) '), ST_MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3 4,3 5,2 5,2 7,5 4,3 4),(5 4,7.4 7,8 7,8 4,5 4))) ') ));
869+
ST_NUMGEOMETRIES(
870+
ST_INTERSECTION(
871+
ST_MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3.8571428571428568 2.857142857142857,5.571428571428571 4.571428571428571,9 4,3.8571428571428568 2.857142857142857)),((4.5 4.75,3 5,4.6 7.4,6 6,4.5 4.75))) '), ST
872+
3

mysql-test/main/gis-precise.test

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,3 +476,13 @@ set @zenica = ST_GeomFromText('POINT(17.907743 44.203438)');
476476
set @sarajevo = ST_GeomFromText('POINT(18.413076 43.856258)');
477477
SELECT TRUNCATE(ST_Distance_Sphere(@zenica, @sarajevo), 10);
478478
SELECT TRUNCATE(ST_Distance_Sphere(@sarajevo, @zenica), 10);
479+
480+
481+
--echo #
482+
--echo # MDEV-31499 Assertion `(0)' failed in Gis_geometry_collection::init_from_opresult.
483+
--echo #
484+
485+
SELECT ST_NUMGEOMETRIES(
486+
ST_INTERSECTION(
487+
ST_MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3.8571428571428568 2.857142857142857,5.571428571428571 4.571428571428571,9 4,3.8571428571428568 2.857142857142857)),((4.5 4.75,3 5,4.6 7.4,6 6,4.5 4.75))) '), ST_MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3 4,3 5,2 5,2 7,5 4,3 4),(5 4,7.4 7,8 7,8 4,5 4))) ') ));
488+

sql/gcalc_tools.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -928,6 +928,7 @@ int Gcalc_operation_reducer::count_slice(Gcalc_scan_iterator *si)
928928
{
929929
add_poly_border(1, cur_t, prev_state, events);
930930
prev_state^= 1;
931+
prev_range= prev_state ? cur_t : 0;
931932
}
932933
if (!events->is_bottom())
933934
{

0 commit comments

Comments
 (0)