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

Revert changes in AbstractPointGeometryFieldMapper #5246

Merged
merged 1 commit into from
Nov 15, 2022

Conversation

heemin32
Copy link
Contributor

@heemin32 heemin32 commented Nov 15, 2022

Description

The change made in AbstractPointGeometryFieldMapper class with commit heemin32@0503897 introduced a performace degradation during point data indexing. Reverting it therefore.

The change was about consolidating array format parsing code for point type in a single place to acheive following benefits.

  1. Allow plugins to override array parsing logic. Plugins can add its own parsing logic for point field by providing object parser. However, it cannot override array format. Therefore, plugin have to use whatever implemented in AbstractPointGeometryFieldMapper class.
  2. Enhanced code quality by removing duplicated code

There is no change in functionality because 1. There is no change in functionality in OpenSearch and 2. No plugins have its own parsing logic for point data in array format yet.

Issues Resolved

opensearch-project/opensearch-build#2888

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff
  • Commit changes are listed out in CHANGELOG.md file (See: Changelog)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Copy link
Member

@andrross andrross left a comment

Choose a reason for hiding this comment

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

Can you add details to the commit message about why this change was made originally and why it is safe to revert it without impacting any functionality?

CHANGELOG.md Outdated
@@ -75,6 +75,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Bump `opencensus-contrib-http-util` from 0.18.0 to 0.31.1 ([#3633](https://github.com/opensearch-project/OpenSearch/pull/3633))
- Bump `geoip2` from 3.0.1 to 3.0.2 ([#5103](https://github.com/opensearch-project/OpenSearch/pull/5103))
### Changed
- Revert changes in AbstractPointGeometryFieldMapper ([#5246](https://github.com/opensearch-project/OpenSearch/pull/5246))
Copy link
Member

Choose a reason for hiding this comment

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

I think we can omit a changelog entry since it doesn't change any user-facing functionality. I'll add the skip-changelog label to the PR.

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@heemin32
Copy link
Contributor Author

Can you add details to the commit message about why this change was made originally and why it is safe to revert it without impacting any functionality?

ACK

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

The change made in AbstractPointGeometryFieldMapper class
with commit 0503897 introduced
a performace degradation during point data indexing. Reverting it therefore.

The change is about consolidating array format parsing code for point type in a single place to acheive following benefits.
1. Allow plugins to override array parsing logic. Plugins can add its own parsing logic for point field by providing object parser. However, it cannot override array format. Therefore, plugin have to use whatever implemented in AbstractPointGeometryFieldMapper class.
2. Enhanced code quality by removing duplicated code

There is no change in functionality because 1. There is no change in functionality in OpenSearch and 2. No plugins have its own parsing logic for point data in array format yet.

Signed-off-by: Heemin Kim <heemin@amazon.com>
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

@dblock
Copy link
Member

dblock commented Nov 15, 2022

@heemin32 Do you have an issue to re-add this code without the performance penalty? notably the check that raises [geo_point] field type does not accept more than 3 values looked like a useful feature.

@dblock dblock merged commit 3583b80 into opensearch-project:main Nov 15, 2022
@heemin32 heemin32 deleted the patch branch November 15, 2022 16:06
@heemin32
Copy link
Contributor Author

heemin32 commented Nov 15, 2022

@dblock It does check and raise exception. One difference is exception message itself. One is field type does not accept > 3 dimensions and the other is [geo_point] field type does not accept more than 3 values.
We cannot provide specific type name here because xy_point also uses same code path.

One option is to let PointParser to have array parser and move the logic from PointParser to the array parser. Not sure it is worth to do though.

public PointParser(
            String field,
            Supplier<P> pointSupplier,
            CheckedBiFunction<XContentParser, P, P, IOException> objectParser,
            P nullValue,
            boolean ignoreZValue,
            boolean ignoreMalformed,
            CheckedBiFunction<XContentParser, P, P, IOException> arrayParser,
        ) {
            this.field = field;
            this.pointSupplier = pointSupplier;
            this.objectParser = objectParser;
            this.nullValue = nullValue;
            this.ignoreZValue = ignoreZValue;
            this.ignoreMalformed = ignoreMalformed;
            this.geometryParser = new GeometryParser(true, true, true);
            this.arrayParser = arrayParser;
        }

@heemin32
Copy link
Contributor Author

@dblock Could you create backport 2.x PR?

@andrross andrross added the backport 2.x Backport to 2.x branch label Nov 15, 2022
opensearch-trigger-bot bot pushed a commit that referenced this pull request Nov 15, 2022
The change made in AbstractPointGeometryFieldMapper class
with commit 0503897 introduced
a performace degradation during point data indexing. Reverting it therefore.

The change is about consolidating array format parsing code for point type in a single place to acheive following benefits.
1. Allow plugins to override array parsing logic. Plugins can add its own parsing logic for point field by providing object parser. However, it cannot override array format. Therefore, plugin have to use whatever implemented in AbstractPointGeometryFieldMapper class.
2. Enhanced code quality by removing duplicated code

There is no change in functionality because 1. There is no change in functionality in OpenSearch and 2. No plugins have its own parsing logic for point data in array format yet.

Signed-off-by: Heemin Kim <heemin@amazon.com>

Signed-off-by: Heemin Kim <heemin@amazon.com>
(cherry picked from commit 3583b80)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
andrross pushed a commit that referenced this pull request Nov 15, 2022
The change made in AbstractPointGeometryFieldMapper class
with commit 0503897 introduced
a performace degradation during point data indexing. Reverting it therefore.

The change is about consolidating array format parsing code for point type in a single place to acheive following benefits.
1. Allow plugins to override array parsing logic. Plugins can add its own parsing logic for point field by providing object parser. However, it cannot override array format. Therefore, plugin have to use whatever implemented in AbstractPointGeometryFieldMapper class.
2. Enhanced code quality by removing duplicated code

There is no change in functionality because 1. There is no change in functionality in OpenSearch and 2. No plugins have its own parsing logic for point data in array format yet.

Signed-off-by: Heemin Kim <heemin@amazon.com>

Signed-off-by: Heemin Kim <heemin@amazon.com>
(cherry picked from commit 3583b80)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

Signed-off-by: Heemin Kim <heemin@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@dblock
Copy link
Member

dblock commented Nov 15, 2022

[Backport 2.x] Revert changes in AbstractPointGeometryFieldMapper #5260

That was #5260 already I believe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Backport to 2.x branch skip-changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants