Skip to content
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

feat(java): create ivf pq index via Java #2103

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

eddyxu
Copy link
Contributor

@eddyxu eddyxu commented Mar 22, 2024

No description provided.

@eddyxu eddyxu marked this pull request as ready for review March 22, 2024 18:04
@eddyxu eddyxu requested review from beinan and LuQQiu March 22, 2024 18:04
@eddyxu eddyxu self-assigned this Mar 22, 2024
Copy link
Collaborator

@beinan beinan left a comment

Choose a reason for hiding this comment

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

Looks good to me, except a couple very minor exception usage and naming issue.

*/
public IndexBuilder ivfPq(int numPartitions, int numSubVectors) throws IOException {
if (this.params.isPresent()) {
throw new IOException("A different index parameter already set.");
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it might be better to throw a runtime exception or IllegalState exception, because it's not something from IO, what do you think?

* @param numPartitions Number of IVF Partitions.
* @param numSubVectors Number of PQ sub-vectors.
*/
public IndexBuilder ivfPq(int numPartitions, int numSubVectors) throws IOException {
Copy link
Collaborator

Choose a reason for hiding this comment

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

is buildIvfPqIndex() a better method name?

/** Build a Scalar index. */
public IndexBuilder scalar() throws IOException {
if (this.params.isPresent()) {
throw new IOException("A different index parameter already set.");
Copy link
Collaborator

Choose a reason for hiding this comment

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

ditto, IOException might be not appropriate here

this.replace);

} else {
throw new IOException("Unsupported Index Parameter");
Copy link
Collaborator

Choose a reason for hiding this comment

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

ditto

var params = this.params.get();
if (params instanceof IvfPqParams) {
if (columns.size() != 1) {
throw new IOException("Can only create IVF_PQ on one column, got: " + columns);
Copy link
Collaborator

Choose a reason for hiding this comment

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

ditto

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.

None yet

2 participants