Skip to content

Conversation

@gaobinlong
Copy link
Contributor

Description

Similar to #19714.

Use the modern instanceof pattern variables instead of explicit type conversions in the package org.opensearch.index, this can improve the code readability and reduce potential ClassCastException risks.

Most code are generated by LLM, and I checked them manually and reverted the unnecessary and wrong changes.

Related Issues

No issue, just #19595 (comment).

Check List

- [ ] Functionality includes testing.
- [ ] API changes companion pull request created, if applicable.
- [ ] Public documentation issue/PR created, if applicable.

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.

…org.opensearch.index package

Signed-off-by: Binlong Gao <gbinlong@amazon.com>
@github-actions
Copy link
Contributor

github-actions bot commented Nov 1, 2025

✅ Gradle check result for b496cb9: SUCCESS

@codecov
Copy link

codecov bot commented Nov 1, 2025

Codecov Report

❌ Patch coverage is 68.75000% with 80 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.20%. Comparing base (05d0163) to head (bd239ab).
⚠️ Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
.../org/opensearch/index/query/TermsQueryBuilder.java 50.00% 1 Missing and 7 partials ⚠️
...java/org/opensearch/index/engine/EngineConfig.java 0.00% 3 Missing and 3 partials ⚠️
...org/opensearch/index/mapper/NumberFieldMapper.java 83.33% 3 Missing and 3 partials ⚠️
...pensearch/index/search/QueryStringQueryParser.java 63.63% 3 Missing and 1 partial ⚠️
.../org/opensearch/index/translog/TranslogWriter.java 33.33% 3 Missing and 1 partial ⚠️
...nsearch/index/query/SpanMultiTermQueryBuilder.java 62.50% 1 Missing and 2 partials ⚠️
...rch/index/reindex/BulkByScrollResponseBuilder.java 25.00% 1 Missing and 2 partials ⚠️
...a/org/opensearch/index/reindex/ReindexRequest.java 62.50% 0 Missing and 3 partials ⚠️
...n/java/org/opensearch/index/search/MatchQuery.java 0.00% 3 Missing ⚠️
...in/java/org/opensearch/index/shard/IndexShard.java 57.14% 1 Missing and 2 partials ⚠️
... and 26 more
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #19859      +/-   ##
============================================
- Coverage     73.21%   73.20%   -0.01%     
+ Complexity    71226    71142      -84     
============================================
  Files          5754     5754              
  Lines        325300   325268      -32     
  Branches      47053    47055       +2     
============================================
- Hits         238160   238118      -42     
+ Misses        68030    67971      -59     
- Partials      19110    19179      +69     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@sandeshkr419 sandeshkr419 left a comment

Choose a reason for hiding this comment

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

Thanks for making these changes. A few nit-picks to address.

Signed-off-by: Binlong Gao <gbinlong@amazon.com>
@github-actions
Copy link
Contributor

github-actions bot commented Nov 3, 2025

✅ Gradle check result for bd239ab: SUCCESS

@gaobinlong gaobinlong merged commit d822f62 into opensearch-project:main Nov 3, 2025
32 of 33 checks passed
anandpatel9998 pushed a commit to anandpatel9998/OpenSearch that referenced this pull request Nov 3, 2025
…org.opensearch.index package (opensearch-project#19859)

* Replace explicit type conversion with instanceof pattern variable in org.opensearch.index package

Signed-off-by: Binlong Gao <gbinlong@amazon.com>

* Optimize some code

Signed-off-by: Binlong Gao <gbinlong@amazon.com>

---------

Signed-off-by: Binlong Gao <gbinlong@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants