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

Switch type of expandNested from boolean to Boolean #2333

Merged
merged 1 commit into from
Dec 14, 2024

Conversation

heemin32
Copy link
Collaborator

Description

Change the type of the expandNested variable from boolean to Boolean. This modification allows the neural search to pass the expandNestedDocs parameter as-is (null, true, or false), instead of converting null or false to false and true to true.
https://github.com/opensearch-project/neural-search/blob/main/src/main/java/org/opensearch/neuralsearch/query/NeuralQueryBuilder.java#L315

Related Issues

N/A

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.

@heemin32
Copy link
Collaborator Author

Rolling upgrade is failing because the query data type is changed. However, it will pass once this change is back ported to 2.x branch.

Copy link
Member

@martin-gaievski martin-gaievski left a comment

Choose a reason for hiding this comment

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

is there a test that is checking scenario similar to one in neural search (expandNested is not set)?

@heemin32
Copy link
Collaborator Author

is there a test that is checking scenario similar to one in neural search (expandNested is not set)?

Yes. All the existing tests have query without expandNested being set.

Copy link
Member

@martin-gaievski martin-gaievski 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, thank you!

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.

Please add IT and UT for the null value too to ensure everything is working correctly

Comment on lines +67 to +69
public Optional<Boolean> getExpandNested() {
return Optional.ofNullable(expandNested);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we add the default value directly here rather than in src/main/java/org/opensearch/knn/index/query/KNNQueryFactory.java ?

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 will let the factory to decide on default value to be consist with other values. For example, rescoreContext's default value is null but we are still wrapping it as Optional instead of just returning null.

@heemin32
Copy link
Collaborator Author

heemin32 commented Dec 13, 2024

Please add IT and UT for the null value too to ensure everything is working correctly.

All existing nested queries are actually using null value here. So they are already covered.

@heemin32 heemin32 requested a review from navneet1v December 13, 2024 23:50
@heemin32 heemin32 merged commit aa6936a into opensearch-project:main Dec 14, 2024
36 of 38 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Dec 14, 2024
Signed-off-by: Heemin Kim <[email protected]>
(cherry picked from commit aa6936a)
heemin32 added a commit that referenced this pull request Dec 16, 2024
Signed-off-by: Heemin Kim <[email protected]>
(cherry picked from commit aa6936a)

Co-authored-by: Heemin Kim <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants