Commit ea876b39 authored by Alexey Botchkov's avatar Alexey Botchkov

MDEV-13716 point_big test fails in 10.2.

        Implementation for the reverse spatial predicates was lost
        somehow.
parent 6352ec21
...@@ -56,6 +56,7 @@ INSERT INTO t1 VALUES("left3", ST_GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 ...@@ -56,6 +56,7 @@ INSERT INTO t1 VALUES("left3", ST_GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1
SET @p = ST_GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'); SET @p = ST_GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))');
SELECT name, ST_AsText(square) from t1 where MBRContains(@p, square); SELECT name, ST_AsText(square) from t1 where MBRContains(@p, square);
name ST_AsText(square) name ST_AsText(square)
small POLYGON((0 0,0 1,1 1,1 0,0 0))
SELECT name, ST_AsText(square) from t1 where MBRDisjoint(@p, square); SELECT name, ST_AsText(square) from t1 where MBRDisjoint(@p, square);
name ST_AsText(square) name ST_AsText(square)
up3 POLYGON((0 3,0 5,2 5,2 3,0 3)) 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)) ...@@ -90,6 +91,7 @@ down2 POLYGON((0 -2,0 0,2 0,2 -2,0 -2))
left2 POLYGON((-2 0,-2 2,0 2,0 0,-2 0)) left2 POLYGON((-2 0,-2 2,0 2,0 0,-2 0))
SELECT name, ST_AsText(square) from t1 where MBRWithin(@p, square); SELECT name, ST_AsText(square) from t1 where MBRWithin(@p, square);
name ST_AsText(square) name ST_AsText(square)
big POLYGON((0 0,0 3,3 3,3 0,0 0))
SET @vert1 = ST_GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))'); SET @vert1 = ST_GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
SET @horiz1 = ST_GeomFromText('POLYGON ((-2 0, 2 0, -2 0))'); SET @horiz1 = ST_GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
SET @horiz2 = ST_GeomFromText('POLYGON ((-1 0, 3 0, -1 0))'); SET @horiz2 = ST_GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
...@@ -217,7 +219,7 @@ SELECT COUNT(*) ...@@ -217,7 +219,7 @@ SELECT COUNT(*)
FROM t1 FROM t1
WHERE ST_CONTAINS(ST_GeomFromText('POLYGON((2 2,4 2, 4 4, 2 4, 2 2))'),way); WHERE ST_CONTAINS(ST_GeomFromText('POLYGON((2 2,4 2, 4 4, 2 4, 2 2))'),way);
COUNT(*) COUNT(*)
0 9
OPTIMIZE TABLE t1; OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
...@@ -226,7 +228,7 @@ SELECT COUNT(*) ...@@ -226,7 +228,7 @@ SELECT COUNT(*)
FROM t1 FROM t1
WHERE ST_CONTAINS(ST_GeomFromText('POLYGON((2 2,4 2, 4 4, 2 4, 2 2))'),way); WHERE ST_CONTAINS(ST_GeomFromText('POLYGON((2 2,4 2, 4 4, 2 4, 2 2))'),way);
COUNT(*) COUNT(*)
0 9
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1( i INT, g GEOMETRY NOT NULL, SPATIAL INDEX (g)) ENGINE=InnoDB; CREATE TABLE t1( i INT, g GEOMETRY NOT NULL, SPATIAL INDEX (g)) ENGINE=InnoDB;
INSERT INTO t1 VALUES(1, LINESTRING(POINT(1,1), POINT(4, 4))); INSERT INTO t1 VALUES(1, LINESTRING(POINT(1,1), POINT(4, 4)));
......
...@@ -349,7 +349,18 @@ class Item_func_spatial_rel: public Item_bool_func2_with_rev ...@@ -349,7 +349,18 @@ class Item_func_spatial_rel: public Item_bool_func2_with_rev
maybe_null= true; maybe_null= true;
} }
enum Functype functype() const { return spatial_rel; } enum Functype functype() const { return spatial_rel; }
enum Functype rev_functype() const { return spatial_rel; } enum Functype rev_functype() const
{
switch (spatial_rel)
{
case SP_CONTAINS_FUNC:
return SP_WITHIN_FUNC;
case SP_WITHIN_FUNC:
return SP_CONTAINS_FUNC;
default:
return spatial_rel;
}
}
bool is_null() { (void) val_int(); return null_value; } bool is_null() { (void) val_int(); return null_value; }
void add_key_fields(JOIN *join, KEY_FIELD **key_fields, void add_key_fields(JOIN *join, KEY_FIELD **key_fields,
uint *and_level, table_map usable_tables, uint *and_level, table_map usable_tables,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment