Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove InvalidShapeException from GeoPolygonDecomposer #77613

Merged
merged 3 commits into from
Sep 15, 2021

Conversation

iverase
Copy link
Contributor

@iverase iverase commented Sep 13, 2021

InvalidShapeException comes from Spatial4j dependency and should not be part of GeoPolygonDecomposer. Let's replace this exception with an IllegalArgumentException.

The change actually fixes a bug where InvalidShapeException are not properly handle so even if the mappings defined with ignore_malformed set to true, the exception leaks and the setting is ignored. Changing to IllegalArgumentException makes it behave properly.

fixes #77685
fixes #75753

@iverase iverase added :Analytics/Geo Indexing, search aggregations of geo points and shapes >refactoring v8.0.0 v7.16.0 labels Sep 13, 2021
@iverase iverase requested a review from imotov September 13, 2021 09:20
@elasticmachine elasticmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Sep 13, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-analytics-geo (Team:Analytics)

@@ -834,9 +834,6 @@ public void testInvalidSelfCrossingPolygon() {
Exception e = expectThrows(InvalidShapeException.class, () -> builder.close().buildS4J());
assertThat(e.getMessage(), containsString("Self-intersection at or near point ["));
assertThat(e.getMessage(), not(containsString("NaN")));
e = expectThrows(InvalidShapeException.class, () -> buildGeometry(builder.close()));
assertThat(e.getMessage(), containsString("Self-intersection at or near point ["));
assertThat(e.getMessage(), not(containsString("NaN")));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already tested in GeometryIndexerTests

@iverase iverase added the >bug label Sep 14, 2021
@iverase
Copy link
Contributor Author

iverase commented Sep 14, 2021

I change this PR to be a bug fix as it fixes an issue with `ignore_malformed' setting.

Copy link
Contributor

@imotov imotov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@iverase iverase added v7.15.1 auto-backport-and-merge auto-backport Automatically create backport pull requests when merged and removed auto-backport-and-merge labels Sep 15, 2021
@iverase iverase merged commit 2e7ef22 into elastic:master Sep 15, 2021
@iverase iverase deleted the InvalidShapeException branch September 15, 2021 06:02
iverase added a commit to iverase/elasticsearch that referenced this pull request Sep 15, 2021
 fixes a bug where InvalidShapeException are not properly handle so even if the mappings defined with
ignore_malformed set to true, the exception leaks and the setting is ignored
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
7.x
7.15

iverase added a commit that referenced this pull request Sep 15, 2021
fixes a bug where InvalidShapeException are not properly handle so even if the mappings defined with
ignore_malformed set to true, the exception leaks and the setting is ignored
iverase added a commit that referenced this pull request Sep 15, 2021
#77740)

fixes a bug where InvalidShapeException are not properly handle so even if the mappings defined with
ignore_malformed set to true, the exception leaks and the setting is ignored
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/Geo Indexing, search aggregations of geo points and shapes auto-backport Automatically create backport pull requests when merged >bug >refactoring Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v7.15.1 v7.16.0 v8.0.0-beta1
Projects
None yet
5 participants