Skip to content

remove @ExperimentalApi annotations from star-tree code files#20925

Open
ThyTran1402 wants to merge 4 commits intoopensearch-project:mainfrom
ThyTran1402:fix/remove_@ExperimentalApi_from_star_tree
Open

remove @ExperimentalApi annotations from star-tree code files#20925
ThyTran1402 wants to merge 4 commits intoopensearch-project:mainfrom
ThyTran1402:fix/remove_@ExperimentalApi_from_star_tree

Conversation

@ThyTran1402
Copy link
Copy Markdown
Contributor

@ThyTran1402 ThyTran1402 commented Mar 19, 2026

Description

Removes @ExperimentalApi annotations from all star-tree and replaces them with @PublicApi(since = "3.6.0")
Related PR: #18070

Related Issues

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.

@github-actions github-actions bot added enhancement Enhancement or improvement to existing feature or request good first issue Good for newcomers Indexing Indexing, Bulk Indexing and anything related to indexing Search Search query, autocomplete ...etc labels Mar 19, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 19, 2026

PR Reviewer Guide 🔍

(Review updated until commit 93e74af)

Here are some key observations to aid the review process:

🧪 No relevant tests
🔒 No security concerns identified
📝 TODO sections

🔀 No multiple PR themes
⚡ Recommended focus areas for review

Incomplete Migration

This file still retains @ExperimentalApi import and annotation on the class itself (line 14 still imports ExperimentalApi), while the class javadoc is updated to @opensearch.api and @PublicApi is added. The old @ExperimentalApi annotation appears to still be present on the class, meaning both annotations may coexist.

import org.opensearch.common.annotation.ExperimentalApi;
import org.opensearch.index.codec.composite.composite103.Composite103Codec;
import org.opensearch.index.mapper.MapperService;

import java.util.HashMap;
import java.util.Map;

import static org.opensearch.index.codec.CodecService.BEST_COMPRESSION_CODEC;
import static org.opensearch.index.codec.CodecService.DEFAULT_CODEC;
import static org.opensearch.index.codec.CodecService.LZ4;
import static org.opensearch.index.codec.CodecService.ZLIB;

/**
 * Factory class to return the latest composite codec for all the modes
 *
 * @opensearch.api
 */
@PublicApi(since = "3.6.0")
Conflicting Annotations

The class has both @opensearch.internal in its Javadoc and is now annotated with @PublicApi(since = "3.6.0"). These two annotations are contradictory — @opensearch.internal signals the class is not part of the public API, while @PublicApi promotes it to public API. This inconsistency should be resolved.

 * collect relevant metrics across nested aggregations in a single traversal
 * @opensearch.internal
 */
@PublicApi(since = "3.6.0")
public abstract class StarTreeBucketCollector {
Conflicting Annotations

The class Javadoc contains both @opensearch.internal and the newly added @opensearch.api tags simultaneously. These are contradictory designations and should be reconciled — only one should remain.

* Helper class for building star-tree query
*
* @opensearch.internal
* @opensearch.api
*/
TODO Comment

There is a TODO comment inside the StarTreeBuildMode enum indicating that on-heap support may be removed. Promoting this to a public API while having a TODO to potentially remove a member could be a breaking change concern.

public enum StarTreeBuildMode {
    // TODO : remove onheap support unless this proves useful
    ON_HEAP("onheap", (byte) 0),

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 19, 2026

PR Code Suggestions ✨

Latest suggestions up to 93e74af

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Fix stale codec class reference after import update

The class was updated to use Composite103Codec in the imports, but the
COMPOSITE_CODEC constant still references
Composite104Codec.COMPOSITE_INDEX_CODEC_NAME. This will cause a compilation error
since Composite104Codec is no longer imported. Update the reference to use
Composite103Codec.

server/src/main/java/org/opensearch/index/codec/composite/CompositeCodecFactory.java [35]

 @PublicApi(since = "3.6.0")
 public class CompositeCodecFactory {
 
     // we can use this to track the latest composite codec
-    public static final String COMPOSITE_CODEC = Composite104Codec.COMPOSITE_INDEX_CODEC_NAME;
+    public static final String COMPOSITE_CODEC = Composite103Codec.COMPOSITE_INDEX_CODEC_NAME;
Suggestion importance[1-10]: 9

__

Why: The import was changed from Composite104Codec to Composite103Codec, but the COMPOSITE_CODEC constant still references Composite104Codec.COMPOSITE_INDEX_CODEC_NAME, which would cause a compilation error since Composite104Codec is no longer imported.

High
General
Fix conflicting internal and public API annotations

The class has conflicting API annotations: the Javadoc says @opensearch.internal
while the class annotation is @PublicApi. These are contradictory —
@opensearch.internal means the class is not part of the public API, while @PublicApi
marks it as a stable public API. The Javadoc tag should be updated to
@opensearch.api to be consistent with the annotation.

server/src/main/java/org/opensearch/search/aggregations/StarTreeBucketCollector.java [22-26]

 /**
  * collect relevant metrics across nested aggregations in a single traversal
- * @opensearch.internal
+ * @opensearch.api
  */
 @PublicApi(since = "3.6.0")
 public abstract class StarTreeBucketCollector {
Suggestion importance[1-10]: 6

__

Why: The Javadoc tag @opensearch.internal contradicts the @PublicApi annotation added in this PR. Updating the Javadoc to @opensearch.api would make the documentation consistent with the annotation.

Low
Remove conflicting internal annotation from public API class

The class has both @opensearch.internal and @opensearch.api Javadoc tags, which are
contradictory. Since the intent of this PR is to promote to public API, the
@opensearch.internal tag should be removed to avoid confusion about the class's API
stability contract.

server/src/main/java/org/opensearch/search/startree/StarTreeQueryHelper.java [43-47]

 /**
  * Helper class for building star-tree query
  *
- * @opensearch.internal
  * @opensearch.api
  */
 public class StarTreeQueryHelper {
Suggestion importance[1-10]: 5

__

Why: Having both @opensearch.internal and @opensearch.api Javadoc tags is contradictory. Since this PR promotes the class to public API, the @opensearch.internal tag should be removed to avoid confusion.

Low

Previous suggestions

Suggestions up to commit 0224059
CategorySuggestion                                                                                                                                    Impact
Possible issue
Fix stale codec class reference after import update

The import was changed to Composite103Codec but the constant still references
Composite104Codec.COMPOSITE_INDEX_CODEC_NAME. This will cause a compilation error
since Composite104Codec is no longer imported. Update the reference to use
Composite103Codec.COMPOSITE_INDEX_CODEC_NAME.

server/src/main/java/org/opensearch/index/codec/composite/CompositeCodecFactory.java [35]

 @PublicApi(since = "3.6.0")
 public class CompositeCodecFactory {
 
     // we can use this to track the latest composite codec
-    public static final String COMPOSITE_CODEC = Composite104Codec.COMPOSITE_INDEX_CODEC_NAME;
+    public static final String COMPOSITE_CODEC = Composite103Codec.COMPOSITE_INDEX_CODEC_NAME;
Suggestion importance[1-10]: 9

__

Why: The import was changed from Composite104Codec to Composite103Codec, but the constant COMPOSITE_CODEC still references Composite104Codec.COMPOSITE_INDEX_CODEC_NAME, which would cause a compilation error. This is a critical bug introduced by the PR.

High
General
Fix contradictory API visibility annotations

The class has both @opensearch.internal in its Javadoc and @PublicApi annotation,
which are contradictory. @opensearch.internal marks the class as internal/non-public
API, while @PublicApi marks it as a stable public API. The Javadoc tag should be
updated to @opensearch.api to be consistent with the annotation.

server/src/main/java/org/opensearch/search/aggregations/StarTreeBucketCollector.java [22-26]

  * collect relevant metrics across nested aggregations in a single traversal
- * @opensearch.internal
+ * @opensearch.api
  */
 @PublicApi(since = "3.6.0")
 public abstract class StarTreeBucketCollector {
Suggestion importance[1-10]: 6

__

Why: The class has both @opensearch.internal in its Javadoc and @PublicApi annotation, which are contradictory. Updating the Javadoc tag to @opensearch.api would make it consistent with the annotation.

Low
Remove contradictory internal API annotation

The class has both @opensearch.internal and @opensearch.api Javadoc tags, which are
contradictory. Only one should be present. Since the PR intent is to promote to
public API, the @opensearch.internal tag should be removed.

server/src/main/java/org/opensearch/search/startree/StarTreeQueryHelper.java [43-47]

  * Helper class for building star-tree query
  *
- * @opensearch.internal
  * @opensearch.api
  */
 public class StarTreeQueryHelper {
Suggestion importance[1-10]: 6

__

Why: The class has both @opensearch.internal and @opensearch.api Javadoc tags, which are contradictory. Since the PR intent is to promote to public API, the @opensearch.internal tag should be removed to avoid confusion.

Low
Suggestions up to commit 624f381
CategorySuggestion                                                                                                                                    Impact
Possible issue
Fix contradictory internal and public API annotations

The class has both @opensearch.internal in its Javadoc and @PublicApi annotation,
which are contradictory. Internal classes should not be annotated with @PublicApi.
Either remove the @opensearch.internal tag or revert to @ExperimentalApi/keep it
internal without @PublicApi.

server/src/main/java/org/opensearch/search/aggregations/StarTreeBucketCollector.java [22-26]

 /**
  * collect relevant metrics across nested aggregations in a single traversal
- * @opensearch.internal
+ * @opensearch.api
  */
 @PublicApi(since = "3.6.0")
 public abstract class StarTreeBucketCollector {
Suggestion importance[1-10]: 7

__

Why: The class has both @opensearch.internal in its Javadoc and @PublicApi annotation, which are contradictory. The @opensearch.internal tag indicates the class is for internal use only, while @PublicApi marks it as a public API. The Javadoc tag should be updated to @opensearch.api to be consistent with the @PublicApi annotation added in this PR.

Medium

@ThyTran1402 ThyTran1402 marked this pull request as draft March 19, 2026 16:30
@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for 624f381: 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?

@sandeshkr419
Copy link
Copy Markdown
Member

minor suggestion - Try pulling latest main - will make changes easier.

Signed-off-by: Thy Tran <58045538+ThyTran1402@users.noreply.github.com>
Signed-off-by: Thy Tran <58045538+ThyTran1402@users.noreply.github.com>
@ThyTran1402 ThyTran1402 force-pushed the fix/remove_@ExperimentalApi_from_star_tree branch from 624f381 to 0224059 Compare March 20, 2026 04:49
@ThyTran1402
Copy link
Copy Markdown
Contributor Author

ThyTran1402 commented Mar 20, 2026

minor suggestion - Try pulling latest main - will make changes easier.

Yes. This will help to resolve the merge conflicts.

@github-actions
Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit 0224059

Signed-off-by: Thy Tran <58045538+ThyTran1402@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

Persistent review updated to latest commit 93e74af

@ThyTran1402 ThyTran1402 marked this pull request as ready for review March 20, 2026 04:59
@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for 93e74af: 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?

qianchongyang pushed a commit to qianchongyang/OpenSearch that referenced this pull request Mar 20, 2026
Replaced @experimentalapi annotations with @publicapi(since = "3.6.0")
in all star-tree related code files (34 files).

Changes:
- Removed @experimentalapi annotations
- Added @publicapi(since = "3.6.0") as replacement

Related to: opensearch-project#18070, resolves opensearch-project#18499

Fixes opensearch-project#20925
@ThyTran1402
Copy link
Copy Markdown
Contributor Author

Hi @sandeshkr419

Can you review it please?

Thank you!

Signed-off-by: Thy Tran <58045538+ThyTran1402@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

Failed to generate code suggestions for PR

@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for 783f207: 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?

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 Indexing, Bulk Indexing and anything related to indexing Search Search query, autocomplete ...etc

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

2 participants