Skip to content

Commit ea876b3

Browse files
author
Alexey Botchkov
committed
MDEV-13716 point_big test fails in 10.2.
Implementation for the reverse spatial predicates was lost somehow.
1 parent 6352ec2 commit ea876b3

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

mysql-test/suite/innodb_gis/r/rtree.result

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ INSERT INTO t1 VALUES("left3", ST_GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1
5656
SET @p = ST_GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))');
5757
SELECT name, ST_AsText(square) from t1 where MBRContains(@p, square);
5858
name ST_AsText(square)
59+
small POLYGON((0 0,0 1,1 1,1 0,0 0))
5960
SELECT name, ST_AsText(square) from t1 where MBRDisjoint(@p, square);
6061
name ST_AsText(square)
6162
up3 POLYGON((0 3,0 5,2 5,2 3,0 3))
@@ -90,6 +91,7 @@ down2 POLYGON((0 -2,0 0,2 0,2 -2,0 -2))
9091
left2 POLYGON((-2 0,-2 2,0 2,0 0,-2 0))
9192
SELECT name, ST_AsText(square) from t1 where MBRWithin(@p, square);
9293
name ST_AsText(square)
94+
big POLYGON((0 0,0 3,3 3,3 0,0 0))
9395
SET @vert1 = ST_GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
9496
SET @horiz1 = ST_GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
9597
SET @horiz2 = ST_GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
@@ -217,7 +219,7 @@ SELECT COUNT(*)
217219
FROM t1
218220
WHERE ST_CONTAINS(ST_GeomFromText('POLYGON((2 2,4 2, 4 4, 2 4, 2 2))'),way);
219221
COUNT(*)
220-
0
222+
9
221223
OPTIMIZE TABLE t1;
222224
Table Op Msg_type Msg_text
223225
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
@@ -226,7 +228,7 @@ SELECT COUNT(*)
226228
FROM t1
227229
WHERE ST_CONTAINS(ST_GeomFromText('POLYGON((2 2,4 2, 4 4, 2 4, 2 2))'),way);
228230
COUNT(*)
229-
0
231+
9
230232
DROP TABLE t1;
231233
CREATE TABLE t1( i INT, g GEOMETRY NOT NULL, SPATIAL INDEX (g)) ENGINE=InnoDB;
232234
INSERT INTO t1 VALUES(1, LINESTRING(POINT(1,1), POINT(4, 4)));

sql/item_geofunc.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,18 @@ class Item_func_spatial_rel: public Item_bool_func2_with_rev
349349
maybe_null= true;
350350
}
351351
enum Functype functype() const { return spatial_rel; }
352-
enum Functype rev_functype() const { return spatial_rel; }
352+
enum Functype rev_functype() const
353+
{
354+
switch (spatial_rel)
355+
{
356+
case SP_CONTAINS_FUNC:
357+
return SP_WITHIN_FUNC;
358+
case SP_WITHIN_FUNC:
359+
return SP_CONTAINS_FUNC;
360+
default:
361+
return spatial_rel;
362+
}
363+
}
353364
bool is_null() { (void) val_int(); return null_value; }
354365
void add_key_fields(JOIN *join, KEY_FIELD **key_fields,
355366
uint *and_level, table_map usable_tables,

0 commit comments

Comments
 (0)