Skip to content

Remove @ExperimentalApi annotations from star-tree related code #18521

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

happysubin
Copy link

@happysubin happysubin commented Jun 14, 2025

Description

Removal of ExperimentalApi annotations in star-tree related code files

Related Issues

Resolves #18499

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.

Copy link
Contributor

✅ Gradle check result for 1fcabfc: SUCCESS

Copy link

codecov bot commented Jun 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 72.72%. Comparing base (3078649) to head (1fcabfc).
Report is 17 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main   #18521      +/-   ##
============================================
+ Coverage     72.64%   72.72%   +0.08%     
- Complexity    68070    68111      +41     
============================================
  Files          5537     5537              
  Lines        313404   313381      -23     
  Branches      45476    45472       -4     
============================================
+ Hits         227658   227915     +257     
+ Misses        67241    66900     -341     
- Partials      18505    18566      +61     

☔ 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.

@happysubin
Copy link
Author

@sandeshkr419
When you have a moment, could you please take a look at this PR? I'd really appreciate your feedback !!

import org.opensearch.index.compositeindex.datacube.startree.node.StarTreeNode;

/**
* Collects one or more @{@link StarTreeNode}'s
*/
@ExperimentalApi
@PublicApi(since = "2.18.0")
Copy link
Member

Choose a reason for hiding this comment

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

Can we get rid of PublicApi annotation as well? Classes although public, still shouldn't be annotated PublicApi

I think you will get a trail of classes that might fail to build because they are still marked experimental which is okay to remove experimental as well.

Copy link
Author

Choose a reason for hiding this comment

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

Thank you for your review !
However, when I remove the @PublicApi annotation and run the build, I get the following error

error: The element org.opensearch.search.startree.StarTreeNodeCollector is part of the public APIs but is not marked as @PublicApi, @ExperimentalApi or @DeprecatedApi (referenced by org.opensearch.search.startree.filter.DimensionFilter)

How can I resolve this?

Copy link
Contributor

Choose a reason for hiding this comment

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

org.opensearch.search.startree.filter.DimensionFilter too is marked as public api. Can we remove publicApi from the chain and see what's the actual class that could be causing this error ?

Copy link
Author

@happysubin happysubin Jun 23, 2025

Choose a reason for hiding this comment

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

@bharath-techie
I haven’t pushed yet,
I continue removing the PublicApi annotation starting from DimensionFilter,
I end up removing it from the following related classes.
DimensionFilter, DimensionFilterMapper, StarTreeNode, StarTreeFilter, and StarTreeQueryContext

Eventually, this leads to the following error

error: The element org.opensearch.search.startree.StarTreeQueryContext is part of the public APIs but is not marked as @PublicApi, @ExperimentalApi or @DeprecatedApi (referenced by org.opensearch.index.query.QueryShardContext)

Copy link
Contributor

Choose a reason for hiding this comment

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

@sandeshkr419 @expani

I don't see good options other than marking the chain with public API since we have a reference in QueryShardContext.
Any thoughts ?

Copy link
Member

@sandeshkr419 sandeshkr419 Jun 23, 2025

Choose a reason for hiding this comment

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

I strongly don't like the idea of chaining up all the classes as @PublicApi as a workaround.

Thinking out loud some alternatives:

How about introducing a CompositeQueryContext with @PublicApi annotation. Its implementation StarTreeQueryContext can be an internal api or with no annotations. QueryShardContext will then hold CompositeQueryContext instead of StarTreeQueryContext.

I think this can provide a good abstraction since star-tree is also an implementation of composite index. Introducing CompositeQueryContext can hide the star-tree related details and also pave way for future implementations similar to star-tree without having to bundle up query context with additional information.

Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't solve the problem by the way , still the chain of StarTreeQueryContext needs to be PublicApi since CompositeQueryContext is public API.

Copy link
Contributor

Choose a reason for hiding this comment

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

For example if we do the above change , we still have the following chain that needs to be solved

CompositeDataCubeFieldType --> StarTreeQueryContext

Dimension -> CompositeDataCubeFieldType
DimensionDataType -> Dimension
Metric -> CompositeDataCubeFieldType
MetricStat -> Metric

And there is an additional chain :
CompositeIndexSettings --> IndicesService

But it does remove the chain in same package chain - DimensionFilter, StarTreeFilter, DimensionFilterMapper.

Copy link
Member

Choose a reason for hiding this comment

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

Basically exposing a sub-set of interfaces as @PublicAPI is still better (may not be ideal - and we can increment on this) than exposing all the implementations as @PublicAPI.

@bharath-techie
Copy link
Contributor

Thanks a lot for contributing to this PR @happysubin . We also can remove experimentalApi from star tree indexing side of code - https://github.com/opensearch-project/OpenSearch/tree/main/server/src/main/java/org/opensearch/index/compositeindex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement or improvement to existing feature or request good first issue Good for newcomers Indexing & Search _No response_ skip-changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Star Tree] Removal of @ExperimentalApi annotations in star-tree related code files
3 participants