Skip to content

Commit

Permalink
ESQL: Fix issues with ST_* functions and compound geometries (#106992)
Browse files Browse the repository at this point in the history
* Add mores tests to cartesian complex geometry tests

* Support multi-shapes within constant literals

This was not supported for lucene push-down for any of the relates functions on point indices: ST_INTERSECTS, ST_WITHIN, ST_CONTAINS. In addition ST_CONTAINS had specific bugs around handling multi-component shapes within literals/constants.

* Update docs/changelog/106992.yaml

* Delete docs/changelog/106992.yaml

* Control result order for multi-cluster tests
  • Loading branch information
craigtaverner authored Apr 2, 2024
1 parent e8a3c9b commit 499ebbf
Show file tree
Hide file tree
Showing 12 changed files with 417 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,13 @@ id:l, name:keyword, shape:cartesian_shape
7, Bottom right with holes, "POLYGON((2 0\, 3 0\, 3 1\, 2 1\, 2 0)\, (2.4 0.4\, 2.6 0.4\, 2.6 0.6\, 2.4 0.6\, 2.4 0.4))"
8, Top right with holes, "POLYGON((2 2\, 3 2\, 3 3\, 2 3\, 2 2)\, (2.4 2.4\, 2.6 2.4\, 2.6 2.6\, 2.4 2.6\, 2.4 2.4))"
9, Top left with holes, "POLYGON((0 2\, 1 2\, 1 3\, 0 3\, 0 2)\, (0.4 2.4\, 0.6 2.4\, 0.6 2.6\, 0.4 2.6\, 0.4 2.4))"
10, Four diagonals, "MULTILINESTRING((0 0\, 1 1)\, (2 0\, 3 1)\, (2 2\, 3 3)\, (0 2\, 1 3))"
11, Bottom left diagonal, "LINESTRING(0 0\, 1 1)"
12, Bottom right diagonal, "LINESTRING(2 0\, 3 1)"
13, Top right diagonal, "LINESTRING(2 2\, 3 3)"
14, Top left diagonal, "LINESTRING(0 2\, 1 3)"
15, Four points, "MULTIPOINT(0.5 0.5\, 2.5 0.5\, 2.5 2.5\, 0.5 2.5)"
16, Bottom left point, "POINT(0.5 0.5)"
17, Bottom right point, "POINT(2.5 0.5)"
18, Top right point, "POINT(2.5 2.5)"
19, Top left point, "POINT(0.5 2.5)"
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,15 @@ FROM cartesian_multipolygons
| SORT id
;

id:l | name:keyword | shape:cartesian_shape
0 | Four squares | MULTIPOLYGON(((0 0, 1 0, 1 1, 0 1, 0 0)), ((2 0, 3 0, 3 1, 2 1, 2 0)), ((2 2, 3 2, 3 3, 2 3, 2 2)), ((0 2, 1 2, 1 3, 0 3, 0 2)))
1 | Bottom left | POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))
id:l | name:keyword | shape:cartesian_shape
0 | Four squares | MULTIPOLYGON(((0 0, 1 0, 1 1, 0 1, 0 0)), ((2 0, 3 0, 3 1, 2 1, 2 0)), ((2 2, 3 2, 3 3, 2 3, 2 2)), ((0 2, 1 2, 1 3, 0 3, 0 2)))
1 | Bottom left | POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))
5 | Four squares with holes | MULTIPOLYGON(((0 0, 1 0, 1 1, 0 1, 0 0), (0.4 0.4, 0.6 0.4, 0.6 0.6, 0.4 0.6, 0.4 0.4)), ((2 0, 3 0, 3 1, 2 1, 2 0), (2.4 0.4, 2.6 0.4, 2.6 0.6, 2.4 0.6, 2.4 0.4)), ((2 2, 3 2, 3 3, 2 3, 2 2), (2.4 2.4, 2.6 2.4, 2.6 2.6, 2.4 2.6, 2.4 2.4)), ((0 2, 1 2, 1 3, 0 3, 0 2), (0.4 2.4, 0.6 2.4, 0.6 2.6, 0.4 2.6, 0.4 2.4)))
6 | Bottom left with holes | POLYGON((0 0, 1 0, 1 1, 0 1, 0 0), (0.4 0.4, 0.6 0.4, 0.6 0.6, 0.4 0.6, 0.4 0.4))
6 | Bottom left with holes | POLYGON((0 0, 1 0, 1 1, 0 1, 0 0), (0.4 0.4, 0.6 0.4, 0.6 0.6, 0.4 0.6, 0.4 0.4))
10 | Four diagonals | MULTILINESTRING((0 0, 1 1), (2 0, 3 1), (2 2, 3 3), (0 2, 1 3))
11 | Bottom left diagonal | LINESTRING(0 0, 1 1)
15 | Four points | MULTIPOINT(0.5 0.5, 2.5 0.5, 2.5 2.5, 0.5 2.5)
16 | Bottom left point | POINT(0.5 0.5)
;

whereContainsSinglePolygon
Expand All @@ -41,9 +45,11 @@ FROM cartesian_multipolygons
| SORT id
;

id:l | name:keyword | shape:cartesian_shape
1 | Bottom left | POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))
6 | Bottom left with holes | POLYGON((0 0, 1 0, 1 1, 0 1, 0 0), (0.4 0.4, 0.6 0.4, 0.6 0.6, 0.4 0.6, 0.4 0.4))
id:l | name:keyword | shape:cartesian_shape
1 | Bottom left | POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))
6 | Bottom left with holes | POLYGON((0 0, 1 0, 1 1, 0 1, 0 0), (0.4 0.4, 0.6 0.4, 0.6 0.6, 0.4 0.6, 0.4 0.4))
11 | Bottom left diagonal | LINESTRING(0 0, 1 1)
16 | Bottom left point | POINT(0.5 0.5)
;

####################################################################################################
Expand All @@ -62,6 +68,10 @@ id:l | name:keyword | shape:cartesian_shape
1 | Bottom left | POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))
5 | Four squares with holes | MULTIPOLYGON(((0 0, 1 0, 1 1, 0 1, 0 0), (0.4 0.4, 0.6 0.4, 0.6 0.6, 0.4 0.6, 0.4 0.4)), ((2 0, 3 0, 3 1, 2 1, 2 0), (2.4 0.4, 2.6 0.4, 2.6 0.6, 2.4 0.6, 2.4 0.4)), ((2 2, 3 2, 3 3, 2 3, 2 2), (2.4 2.4, 2.6 2.4, 2.6 2.6, 2.4 2.6, 2.4 2.4)), ((0 2, 1 2, 1 3, 0 3, 0 2), (0.4 2.4, 0.6 2.4, 0.6 2.6, 0.4 2.6, 0.4 2.4)))
6 | Bottom left with holes | POLYGON((0 0, 1 0, 1 1, 0 1, 0 0), (0.4 0.4, 0.6 0.4, 0.6 0.6, 0.4 0.6, 0.4 0.4))
10 | Four diagonals | MULTILINESTRING((0 0, 1 1), (2 0, 3 1), (2 2, 3 3), (0 2, 1 3))
11 | Bottom left diagonal | LINESTRING(0 0, 1 1)
15 | Four points | MULTIPOINT(0.5 0.5, 2.5 0.5, 2.5 2.5, 0.5 2.5)
16 | Bottom left point | POINT(0.5 0.5)
;

whereContainsSmallerPolygon
Expand All @@ -86,6 +96,7 @@ FROM cartesian_multipolygons
;

id:l | name:keyword | shape:cartesian_shape
16 | Bottom left point | POINT(0.5 0.5)
;

####################################################################################################
Expand All @@ -110,6 +121,16 @@ id:l | name:keyword | shape:cartesian_shape
7 | Bottom right with holes | POLYGON((2 0, 3 0, 3 1, 2 1, 2 0), (2.4 0.4, 2.6 0.4, 2.6 0.6, 2.4 0.6, 2.4 0.4))
8 | Top right with holes | POLYGON((2 2, 3 2, 3 3, 2 3, 2 2), (2.4 2.4, 2.6 2.4, 2.6 2.6, 2.4 2.6, 2.4 2.4))
9 | Top left with holes | POLYGON((0 2, 1 2, 1 3, 0 3, 0 2), (0.4 2.4, 0.6 2.4, 0.6 2.6, 0.4 2.6, 0.4 2.4))
10 | Four diagonals | MULTILINESTRING((0 0, 1 1), (2 0, 3 1), (2 2, 3 3), (0 2, 1 3))
11 | Bottom left diagonal | LINESTRING(0 0, 1 1)
12 | Bottom right diagonal | LINESTRING(2 0, 3 1)
13 | Top right diagonal | LINESTRING(2 2, 3 3)
14 | Top left diagonal | LINESTRING(0 2, 1 3)
15 | Four points | MULTIPOINT(0.5 0.5, 2.5 0.5, 2.5 2.5, 0.5 2.5)
16 | Bottom left point | POINT(0.5 0.5)
17 | Bottom right point | POINT(2.5 0.5)
18 | Top right point | POINT(2.5 2.5)
19 | Top left point | POINT(0.5 2.5)
;

whereContainsLargerPolygon
Expand Down Expand Up @@ -142,6 +163,16 @@ id:l | name:keyword | shape:cartesian_shape
7 | Bottom right with holes | POLYGON((2 0, 3 0, 3 1, 2 1, 2 0), (2.4 0.4, 2.6 0.4, 2.6 0.6, 2.4 0.6, 2.4 0.4))
8 | Top right with holes | POLYGON((2 2, 3 2, 3 3, 2 3, 2 2), (2.4 2.4, 2.6 2.4, 2.6 2.6, 2.4 2.6, 2.4 2.4))
9 | Top left with holes | POLYGON((0 2, 1 2, 1 3, 0 3, 0 2), (0.4 2.4, 0.6 2.4, 0.6 2.6, 0.4 2.6, 0.4 2.4))
10 | Four diagonals | MULTILINESTRING((0 0, 1 1), (2 0, 3 1), (2 2, 3 3), (0 2, 1 3))
11 | Bottom left diagonal | LINESTRING(0 0, 1 1)
12 | Bottom right diagonal | LINESTRING(2 0, 3 1)
13 | Top right diagonal | LINESTRING(2 2, 3 3)
14 | Top left diagonal | LINESTRING(0 2, 1 3)
15 | Four points | MULTIPOINT(0.5 0.5, 2.5 0.5, 2.5 2.5, 0.5 2.5)
16 | Bottom left point | POINT(0.5 0.5)
17 | Bottom right point | POINT(2.5 0.5)
18 | Top right point | POINT(2.5 2.5)
19 | Top left point | POINT(0.5 2.5)
;

####################################################################################################
Expand All @@ -166,6 +197,16 @@ id:l | name:keyword | shape:cartesian_shape
7 | Bottom right with holes | POLYGON((2 0, 3 0, 3 1, 2 1, 2 0), (2.4 0.4, 2.6 0.4, 2.6 0.6, 2.4 0.6, 2.4 0.4))
8 | Top right with holes | POLYGON((2 2, 3 2, 3 3, 2 3, 2 2), (2.4 2.4, 2.6 2.4, 2.6 2.6, 2.4 2.6, 2.4 2.4))
9 | Top left with holes | POLYGON((0 2, 1 2, 1 3, 0 3, 0 2), (0.4 2.4, 0.6 2.4, 0.6 2.6, 0.4 2.6, 0.4 2.4))
10 | Four diagonals | MULTILINESTRING((0 0, 1 1), (2 0, 3 1), (2 2, 3 3), (0 2, 1 3))
11 | Bottom left diagonal | LINESTRING(0 0, 1 1)
12 | Bottom right diagonal | LINESTRING(2 0, 3 1)
13 | Top right diagonal | LINESTRING(2 2, 3 3)
14 | Top left diagonal | LINESTRING(0 2, 1 3)
15 | Four points | MULTIPOINT(0.5 0.5, 2.5 0.5, 2.5 2.5, 0.5 2.5)
16 | Bottom left point | POINT(0.5 0.5)
17 | Bottom right point | POINT(2.5 0.5)
18 | Top right point | POINT(2.5 2.5)
19 | Top left point | POINT(0.5 2.5)
;

whereContainsEvenLargerPolygon
Expand Down Expand Up @@ -198,4 +239,14 @@ id:l | name:keyword | shape:cartesian_shape
7 | Bottom right with holes | POLYGON((2 0, 3 0, 3 1, 2 1, 2 0), (2.4 0.4, 2.6 0.4, 2.6 0.6, 2.4 0.6, 2.4 0.4))
8 | Top right with holes | POLYGON((2 2, 3 2, 3 3, 2 3, 2 2), (2.4 2.4, 2.6 2.4, 2.6 2.6, 2.4 2.6, 2.4 2.4))
9 | Top left with holes | POLYGON((0 2, 1 2, 1 3, 0 3, 0 2), (0.4 2.4, 0.6 2.4, 0.6 2.6, 0.4 2.6, 0.4 2.4))
10 | Four diagonals | MULTILINESTRING((0 0, 1 1), (2 0, 3 1), (2 2, 3 3), (0 2, 1 3))
11 | Bottom left diagonal | LINESTRING(0 0, 1 1)
12 | Bottom right diagonal | LINESTRING(2 0, 3 1)
13 | Top right diagonal | LINESTRING(2 2, 3 3)
14 | Top left diagonal | LINESTRING(0 2, 1 3)
15 | Four points | MULTIPOINT(0.5 0.5, 2.5 0.5, 2.5 2.5, 0.5 2.5)
16 | Bottom left point | POINT(0.5 0.5)
17 | Bottom right point | POINT(2.5 0.5)
18 | Top right point | POINT(2.5 2.5)
19 | Top left point | POINT(0.5 2.5)
;
Loading

0 comments on commit 499ebbf

Please sign in to comment.