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

Accommodate changes to XContent classes #125

Merged
merged 1 commit into from
Apr 1, 2023

Conversation

msfroh
Copy link
Collaborator

@msfroh msfroh commented Mar 30, 2023

There was a commit to OpenSearch core to move XContent classes, forcing us to update a bunch of imports.

This change is effectively a cherry-pick of
87dafb0 without modifying the build.gradle file.

Issues Resolved

#120

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed as per the DCO using --signoff

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.

There was a commit to OpenSearch core to move XContent classes,
forcing us to update a bunch of imports.

This change is effectively a cherry-pick of
87dafb0 without modifying the
build.gradle file.

Signed-off-by: Michael Froh <[email protected]>
@codecov-commenter
Copy link

Codecov Report

Merging #125 (42b31c1) into 2.x (d7f55d6) will increase coverage by 6.83%.
The diff coverage is 50.00%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@             Coverage Diff              @@
##                2.x     #125      +/-   ##
============================================
+ Coverage     70.61%   77.44%   +6.83%     
- Complexity      197      206       +9     
============================================
  Files            29       29              
  Lines           878      878              
  Branches        120      120              
============================================
+ Hits            620      680      +60     
+ Misses          208      138      -70     
- Partials         50       60      +10     
Impacted Files Coverage Δ
...search/search/relevance/SearchRelevancePlugin.java 0.00% <ø> (ø)
...e/configuration/SearchConfigurationExtBuilder.java 67.64% <ø> (ø)
...evance/configuration/TransformerConfiguration.java 100.00% <ø> (+50.00%) ⬆️
.../KendraIntelligentRankingConfigurationFactory.java 0.00% <ø> (ø)
...uration/KendraIntelligentRankingConfiguration.java 82.65% <50.00%> (+56.12%) ⬆️

... and 1 file with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@@ -76,7 +77,7 @@ public void writeTo(StreamOutput out) throws IOException {
this.properties.writeTo(out);
}

public static ResultTransformerConfiguration parse(XContentParser parser) throws IOException {
public static KendraIntelligentRankingConfiguration parse(XContentParser parser) throws IOException {
Copy link
Collaborator

Choose a reason for hiding this comment

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

re:naming - is this going from less specific naming to more specific intentionally?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes.

a) It helps the unit tests, since we can confirm the specific type.
b) There's a best-practice to take the most general type of argument and return the most specific type. I think it's an application of the Liskov substitution principle.

@@ -154,7 +155,7 @@ public KendraIntelligentRankingProperties(final List<String> bodyFields,

public KendraIntelligentRankingProperties(StreamInput input) throws IOException {
this.bodyFields = input.readStringList();
this.bodyFields = input.readStringList();
this.titleFields = input.readStringList();
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this related to the XContent classes change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not directly.

When merging the cherry-picked commit, I also picked up the unit tests that I had previously added (in KendraIntelligentRankingConfigurationTests).

When I added those tests in main, they also revealed some bugs (like this one). I should go through and make sure that all of the tests I added in main get backported to 2.x, since I fixed a bunch of little bugs along the way.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh... I just added the backport 2.x label to #99.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh, but the backport PR fails to build because we need to merge this PR to fix the XContent stuff:

#126

Copy link
Collaborator

@noCharger noCharger Mar 31, 2023

Choose a reason for hiding this comment

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

Oh, but the backport PR fails to build because we need to merge this PR to fix the XContent stuff:

#126

Looks like there are two ways to handle this issue:

  1. In this PR, remove the content of Improve test coverage #99, merge this one and merge [Backport 2.x] Improve test coverage #126
  2. Change the description to include the backport of Improve test coverage #99, then merge this one; the backport PR [Backport 2.x] Improve test coverage #126 is pointless in this case because the code is already include.

I'm fine with either, but 1. appears to overreact, and the order of commits in 2.x is messed up comparing to main branch

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think #126 shouldn't have any conflicts once this one is merged, because any overlapping changes should be identical.

@noCharger noCharger merged commit 238668c into opensearch-project:2.x Apr 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants