Skip to content

Commit ac2e0be

Browse files
committed
Adds more tests
1 parent e5e3d44 commit ac2e0be

File tree

6 files changed

+354
-20
lines changed

6 files changed

+354
-20
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Eclipse Distribution License - v 1.0
2+
3+
Copyright (c) 2007, Eclipse Foundation, Inc. and its licensors.
4+
5+
All rights reserved.
6+
7+
Redistribution and use in source and binary forms, with or without
8+
modification, are permitted provided that the following conditions are met:
9+
10+
Redistributions of source code must retain the above copyright notice, this
11+
list of conditions and the following disclaimer.
12+
13+
Redistributions in binary form must reproduce the above copyright notice,
14+
this list of conditions and the following disclaimer in the documentation
15+
and/or other materials provided with the distribution.
16+
17+
Neither the name of the Eclipse Foundation, Inc. nor the names of its
18+
contributors may be used to endorse or promote products derived from this
19+
software without specific prior written permission.
20+
21+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
25+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
28+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

x-pack/plugin/esql/qa/testFixtures/src/main/resources/spatial.csv-spec

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3025,6 +3025,10 @@ wkt:keyword |pt:cartesian_point
30253025
// end::to_cartesianpoint-str-parse-error-result[]
30263026
;
30273027

3028+
###############################################
3029+
# Tests for ST_SIMPLIFY
3030+
###############################################
3031+
30283032
stSimplifyMultiRow
30293033
required_capability: st_simplify
30303034

@@ -3096,3 +3100,47 @@ ROW geo_shape = TO_GEOSHAPE("POLYGON((0 0, 1 0.1, 2 0, 2 2, 1 1.9, 0 2, 0 0))")
30963100
result:geo_shape
30973101
POLYGON EMPTY
30983102
;
3103+
3104+
stSimplifyNull
3105+
required_capability: st_simplify
3106+
3107+
ROW geo_shape = NULL
3108+
| EVAL result = st_simplify(geo_shape, 2.0)
3109+
| KEEP result
3110+
;
3111+
3112+
result:geo_shape
3113+
NULL
3114+
;
3115+
3116+
stSimplifyCartesianPoint
3117+
required_capability: st_simplify
3118+
3119+
# TODO Why cannot we use a latitud outside of -90, 90 when there are tests
3120+
# that use the TO_CARTESIANPOINT that are doing it already?
3121+
ROW wkt = ["POINT(97.11 75.53)", "POINT(80.93 72.77)"]
3122+
| MV_EXPAND wkt
3123+
| EVAL pt = TO_CARTESIANPOINT(wkt)
3124+
| EVAL result = st_simplify(pt, 2.0)
3125+
| KEEP result
3126+
;
3127+
3128+
result:geo_shape
3129+
POINT (97.11 75.53)
3130+
POINT (80.93 72.77)
3131+
;
3132+
3133+
stSimplifyCartesianShape
3134+
required_capability: st_simplify
3135+
3136+
ROW wkt = ["POINT(97.11 75.53)", "POLYGON((0 0, 1 0.1, 2 0, 2 2, 1 1.9, 0 2, 0 0))"]
3137+
| MV_EXPAND wkt
3138+
| EVAL geom = TO_CARTESIANSHAPE(wkt)
3139+
| EVAL result = st_simplify(geom, 0.2)
3140+
| KEEP result
3141+
;
3142+
3143+
result:geo_shape
3144+
POINT (97.11 75.53)
3145+
POLYGON ((0.0 0.0, 0.0 2.0, 2.0 2.0, 2.0 0.0, 0.0 0.0))
3146+
;

x-pack/plugin/esql/src/main/generated/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StSimplifyFoldableGeoAndConstantToleranceEvaluator.java

Lines changed: 114 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/plugin/esql/src/main/generated/org/elasticsearch/xpack/esql/expression/function/scalar/spatial/StSimplifyNonFoldableGeoAndConstantToleranceEvaluator.java

Lines changed: 155 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)