From a175314c3e5827eb193872241446f2f8f5c9d33c Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 4 May 2024 20:07:14 +0200 Subject: Adding upstream version 1:10.5.12. Signed-off-by: Daniel Baumann --- .../suite/maria/maria-gis-rtree-dynamic.test | 891 +++++++++++++++++++++ 1 file changed, 891 insertions(+) create mode 100644 mysql-test/suite/maria/maria-gis-rtree-dynamic.test (limited to 'mysql-test/suite/maria/maria-gis-rtree-dynamic.test') diff --git a/mysql-test/suite/maria/maria-gis-rtree-dynamic.test b/mysql-test/suite/maria/maria-gis-rtree-dynamic.test new file mode 100644 index 00000000..8dd1d04d --- /dev/null +++ b/mysql-test/suite/maria/maria-gis-rtree-dynamic.test @@ -0,0 +1,891 @@ +-- source include/have_maria.inc +-- source include/have_geometry.inc + +set default_storage_engine=aria; + +# +# test of rtree (using with spatial data) +# +--disable_warnings +DROP TABLE IF EXISTS t1, t2; +--enable_warnings + +CREATE TABLE t1 ( + fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + g GEOMETRY NOT NULL, + SPATIAL KEY(g) +) row_format=dynamic; + +SHOW CREATE TABLE t1; + +let $1=150; +let $2=150; +while ($1) +{ + eval INSERT INTO t1 (g) VALUES (GeomFromText('LineString($1 $1, $2 $2)')); + dec $1; + inc $2; +} + +SELECT count(*) FROM t1; +EXPLAIN SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))')); +SELECT fid, AsText(g) FROM t1 WHERE Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))')); + +DROP TABLE t1; + +CREATE TABLE t2 ( + fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + g GEOMETRY NOT NULL +) row_format=dynamic; + +let $1=10; +while ($1) +{ + let $2=10; + while ($2) + { + eval INSERT INTO t2 (g) VALUES (GeometryFromWKB(LineString(Point($1 * 10 - 9, $2 * 10 - 9), Point($1 * 10, $2 * 10)))); + dec $2; + } + dec $1; +} + +ALTER TABLE t2 ADD SPATIAL KEY(g); +SHOW CREATE TABLE t2; +SELECT count(*) FROM t2; +EXPLAIN SELECT fid, AsText(g) FROM t2 WHERE Within(g, + GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))')); +SELECT fid, AsText(g) FROM t2 WHERE Within(g, + GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))')); + +let $1=10; +while ($1) +{ + let $2=10; + while ($2) + { + eval DELETE FROM t2 WHERE Within(g, Envelope(GeometryFromWKB(LineString(Point($1 * 10 - 9, $2 * 10 - 9), Point($1 * 10, $2 * 10))))); + SELECT count(*) FROM t2; + dec $2; + } + dec $1; +} + +DROP TABLE t2; + +drop table if exists t1; +CREATE TABLE t1 (a geometry NOT NULL, SPATIAL (a)) row_format=dynamic; +INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)")); +INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)")); +INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)")); +INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)")); +INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)")); +INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)")); +INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)")); +INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)")); +INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)")); +INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)")); +INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)")); +INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)")); +INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)")); +INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)")); +INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)")); +INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)")); +INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)")); +INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)")); +INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)")); +INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)")); +INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)")); +INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)")); +INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)")); +INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)")); +INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)")); +INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)")); +INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)")); +INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)")); +INSERT INTO t1 VALUES (GeomFromText("LINESTRING(100 100, 200 200, 300 300)")); +check table t1; +analyze table t1; +drop table t1; + +# +# The following crashed gis +# + +CREATE TABLE t1 ( + fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + g GEOMETRY NOT NULL, + SPATIAL KEY(g) +) row_format=dynamic; + +INSERT INTO t1 (g) VALUES (GeomFromText('LineString(1 2, 2 3)')),(GeomFromText('LineString(1 2, 2 4)')); +#select * from t1 where g