Skip to content

Conversation

@pado0
Copy link
Contributor

@pado0 pado0 commented Nov 8, 2025

Description

This PR refactors the FieldDataStats and CompletionStats class to use the Builder pattern instead of relying on multiple constructors.

By adopting the Builder pattern, it becomes easier to evolve the stats API, add new metrics, and maintain backward compatibility without forcing disruptive constructor changes.

Based on the related issue:

  1. Added a Builder and deprecated the existing constructors.
  2. Replaced usages of constructors in code and tests with the new Builder.

There are multiple stats-related classes that need similar refactoring, and we are addressing them in priority order. This PR covers FieldDataStats and CompletionStats as part of that effort.

Related Issues

Related to #19225

Check List

  • Functionality includes testing.

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.

@pado0 pado0 changed the title Refactor FieldDataStats and CompletionStats with Builder pattern #19863 Refactor FieldDataStats and CompletionStats with Builder pattern Nov 8, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 9, 2025

❌ Gradle check result for 3e45413: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions
Copy link
Contributor

github-actions bot commented Nov 9, 2025

❌ Gradle check result for 3e45413: null

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions
Copy link
Contributor

github-actions bot commented Nov 9, 2025

❕ Gradle check result for 3e45413: UNSTABLE

Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure.

@codecov
Copy link

codecov bot commented Nov 9, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.21%. Comparing base (4dc8704) to head (0a65b90).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main   #19936      +/-   ##
============================================
- Coverage     73.25%   73.21%   -0.05%     
- Complexity    71555    71563       +8     
============================================
  Files          5785     5785              
  Lines        326828   326935     +107     
  Branches      47295    47295              
============================================
- Hits         239429   239365      -64     
- Misses        68163    68351     +188     
+ Partials      19236    19219      -17     

☔ 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 working on this. I have one method rename nit comment. Rest LGTM!

Signed-off-by: Jean Kim <bgshhd95@gmail.com>
Signed-off-by: Jean Kim <bgshhd95@gmail.com>
Signed-off-by: Jean Kim <bgshhd95@gmail.com>
Signed-off-by: Jean Kim <bgshhd95@gmail.com>
@pado0 pado0 force-pushed the builder-fielddata-completion branch from 3e45413 to cf9e58d Compare November 11, 2025 01:16
Signed-off-by: Jean Kim <bgshhd95@gmail.com>
@github-actions
Copy link
Contributor

✅ Gradle check result for 0a65b90: SUCCESS

@sandeshkr419 sandeshkr419 merged commit b08de24 into opensearch-project:main Nov 11, 2025
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Refactor] Use Builder pattern instead of constructors for Stats API classes

2 participants