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

K-NN Plugin Upgrade with Lucene 10.0.1 #2429

Merged
merged 1 commit into from
Feb 6, 2025

Conversation

Vikasht34
Copy link
Collaborator

@Vikasht34 Vikasht34 commented Jan 23, 2025

Description

As per Lucene 10.0.1 upgrade, There are lots of breaking changes. This PR consumes Lucene 10.0.1 as part of Opensearch 3.0.0 snapshot and Fixes all breaking changes.

Note :- This PR Does not aim to refactor any part of code, It's just making compatible with Lucene 10.0.1

Resolves this issues

#2434
#2433

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

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.

@martin-gaievski
Copy link
Member

it looks like opensearch-knn-test-fixtures needs to consume latest corre main with lucene 10

/home/runner/work/k-NN/k-NN/src/main/java/org/opensearch/knn/index/codec/KNNCodecVersion.java:16: error: package org.apache.lucene.backward_codecs.lucene912 does not exist
import org.apache.lucene.backward_codecs.lucene912.Lucene912Codec;

@Vikasht34
Copy link
Collaborator Author

it looks like opensearch-knn-test-fixtures needs to consume latest corre main with lucene 10

/home/runner/work/k-NN/k-NN/src/main/java/org/opensearch/knn/index/codec/KNNCodecVersion.java:16: error: package org.apache.lucene.backward_codecs.lucene912 does not exist
import org.apache.lucene.backward_codecs.lucene912.Lucene912Codec;

Yes ...Agree ...We need to change to alpha !! lots of things started breaking ..This Pr would be updated with all latest changes.

@Vikasht34 Vikasht34 marked this pull request as draft January 24, 2025 21:49
@Vikasht34 Vikasht34 force-pushed the CodecFix branch 8 times, most recently from 934094b to e0f283e Compare February 1, 2025 23:19
@Vikasht34 Vikasht34 changed the title Fixing Lucene912Codec Issue with BWC for Lucene 10.0.1 upgrade K-NN Plugin Upgrade with Lucene 10.0.1 Feb 2, 2025
@Vikasht34 Vikasht34 force-pushed the CodecFix branch 9 times, most recently from 1a823aa to f46aae1 Compare February 4, 2025 19:33
@@ -81,12 +80,13 @@ public float[] get(int i) {
* @return A KNNVectorScriptDocValues object based on the type of the values.
* @throws IllegalArgumentException If the type of values is unsupported.
*/
public static KNNVectorScriptDocValues create(DocIdSetIterator values, String fieldName, VectorDataType vectorDataType) {
public static KNNVectorScriptDocValues create(Object values, String fieldName, VectorDataType vectorDataType) {
Copy link
Collaborator

@navneet1v navneet1v Feb 5, 2025

Choose a reason for hiding this comment

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

can we avoid passing the Object here? Can we use KNNVectorValues abstraction we have created in our k-NN plugin.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I can give a try in next PR. I was thinking to compplety remove all the abstraction we have created. I will discuss with you.

Copy link
Collaborator

Choose a reason for hiding this comment

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

In this case lets cut a GH issue and put it as a TODO as part of 3.0 release that we need to pick that item

@Vikasht34 Vikasht34 requested a review from navneet1v February 5, 2025 17:34
private int lastOrd = -1;
@Getter
@Setter
private Object lastAccessedVector = null;
Copy link
Collaborator

Choose a reason for hiding this comment

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

same as the old comment, lets try to avoid Object data type. Please have a GH issue on this and should be taken as part of next PR.

protected DocIdSetIterator docIdSetIterator;
private static final List<Function<DocIdSetIterator, Boolean>> VALID_ITERATOR_INSTANCE = List.of(
(itr) -> itr instanceof BinaryDocValues,
(itr) -> itr instanceof FloatVectorValues,
(itr) -> itr instanceof ByteVectorValues
);

DocIdsIteratorValues(@NonNull final DocIdSetIterator docIdSetIterator) {
validateIteratorType(docIdSetIterator);
private final DocIdSetIterator docIdSetIterator;
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 this class will also need a bit of refactoring, for now to unblock main this is fine. Lets have a GH issue for this to fix the abstraction. Because this class otherwise is not going to be maintainable in future

Copy link
Collaborator

@navneet1v navneet1v left a comment

Choose a reason for hiding this comment

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

Approving the code. Lets have the follow up GH issues and PR on the refactoring. Since k-NN plugin is dependency for other plugins I am approving this PR so that we can unblock other plugin main branches

@Vikasht34 Vikasht34 merged commit c22ba17 into opensearch-project:main Feb 6, 2025
38 checks passed
@Vikasht34 Vikasht34 deleted the CodecFix branch February 6, 2025 18:21
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.

4 participants