-
Notifications
You must be signed in to change notification settings - Fork 109
[Java] Exposing merge API for multiple CAGRA indices #891
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
Merged
rapids-bot
merged 15 commits into
rapidsai:branch-25.06
from
SearchScale:merge-api-java-support
May 29, 2025
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
da9163a
[Java] Merge API changes passing merge_params as NULL using default v…
punAhuja 7cac5d2
[Java] Added changes to support custom merge_params during merge
punAhuja d2a1e3d
Consolidate Cagra index merge tests into CagraBuildAndSearchIT; resol…
punAhuja 447e8fc
Resolved review comments
punAhuja e682d01
Merge branch 'branch-25.06' into merge-api-java-support
narangvivek10 3d81107
Incorporating review feedback
6b65b70
Merge branch 'branch-25.06' into merge-api-java-support
narangvivek10 6aadcb5
Removing commented out code
d8f7edf
Increasing test iterations, relaxing topK checking by considering add…
282fd70
Merge branch 'branch-25.06' into merge-api-java-support
narangvivek10 baadde4
Merge branch 'branch-25.06' into merge-api-java-support
narangvivek10 9bada34
Merge branch 'branch-25.06' into merge-api-java-support
narangvivek10 3a749e9
Merge branch 'branch-25.06' into merge-api-java-support
narangvivek10 d9a7089
Merge branch 'branch-25.06' into merge-api-java-support
narangvivek10 6f855d4
fix compilation error - set vectors to null
narangvivek10 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
105 changes: 105 additions & 0 deletions
105
java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraMergeParams.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
/* | ||
* Copyright (c) 2025, NVIDIA CORPORATION. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.nvidia.cuvs; | ||
public class CagraMergeParams { | ||
|
||
private final CagraIndexParams outputIndexParams; | ||
private final MergeStrategy strategy; | ||
|
||
/** | ||
* Constructs a CagraMergeParams with the given output index parameters and merge strategy. | ||
* | ||
* @param outputIndexParams Index parameters for the output index | ||
* @param strategy Merge strategy to use | ||
*/ | ||
private CagraMergeParams(CagraIndexParams outputIndexParams, MergeStrategy strategy) { | ||
this.outputIndexParams = outputIndexParams; | ||
this.strategy = strategy; | ||
} | ||
|
||
/** | ||
* Gets the index parameters for the output index. | ||
* | ||
* @return Index parameters to use for the output index | ||
*/ | ||
public CagraIndexParams getOutputIndexParams() { | ||
return outputIndexParams; | ||
} | ||
|
||
/** | ||
* Gets the merge strategy to use. | ||
* | ||
* @return The merge strategy | ||
*/ | ||
public MergeStrategy getStrategy() { | ||
return strategy; | ||
} | ||
|
||
/** | ||
* Strategy to use when merging CAGRA indexes. | ||
*/ | ||
public enum MergeStrategy { | ||
PHYSICAL(0), | ||
|
||
LOGICAL(1); | ||
|
||
public final int value; | ||
|
||
MergeStrategy(int value) { | ||
this.value = value; | ||
} | ||
} | ||
|
||
/** | ||
* Builder class for {@link CagraMergeParams}. | ||
*/ | ||
public static class Builder { | ||
private CagraIndexParams outputIndexParams = new CagraIndexParams.Builder().build(); | ||
private MergeStrategy strategy = MergeStrategy.PHYSICAL; // Default to PHYSICAL | ||
|
||
/** | ||
* Sets the index parameters for the output index. | ||
* | ||
* @param outputIndexParams Index parameters to use for the output index | ||
* @return This builder | ||
*/ | ||
public Builder withOutputIndexParams(CagraIndexParams outputIndexParams) { | ||
this.outputIndexParams = outputIndexParams; | ||
return this; | ||
} | ||
|
||
/** | ||
* Sets the merge strategy. | ||
* | ||
* @param strategy The merge strategy to use | ||
* @return This builder | ||
*/ | ||
public Builder withStrategy(MergeStrategy strategy) { | ||
this.strategy = strategy; | ||
return this; | ||
} | ||
|
||
/** | ||
* Builds the {@link CagraMergeParams} object. | ||
* | ||
* @return The built parameters | ||
*/ | ||
public CagraMergeParams build() { | ||
return new CagraMergeParams(outputIndexParams, strategy); | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.