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

[Fix] add non-null check for queryBuilder in NeuralQueryEnricherProcessor #615

Merged
merged 3 commits into from
Feb 29, 2024

Conversation

zhichao-aws
Copy link
Member

Description

In #337 and #541 we support the default model id for neural and hybrid query. However, in current implementation, after we set up a search pipeline to support default model id, we can not search with empty query body (i.e. GET /index_name/_search or POST /index_name/_search). We'll get exception like below:

TransportError(500, 'null_pointer_exception', 'Cannot invoke "org.opensearch.index.query.QueryBuilder.visit(org.opensearch.index.query.QueryBuilderVisitor)" because "queryBuilder" is null').

This PR fix this exception by adding a non-null check in NeuralQueryEnricherProcessor.

Issues Resolved

[List any issues this PR will resolve]

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed as per the DCO using --signoff

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.

Copy link

codecov bot commented Feb 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.44%. Comparing base (ab59d66) to head (38eda5f).

Additional details and impacted files
@@            Coverage Diff            @@
##               main     #615   +/-   ##
=========================================
  Coverage     84.43%   84.44%           
- Complexity      603      604    +1     
=========================================
  Files            48       48           
  Lines          1825     1826    +1     
  Branches        275      276    +1     
=========================================
+ Hits           1541     1542    +1     
  Misses          161      161           
  Partials        123      123           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@zhichao-aws
Copy link
Member Author

zhichao-aws commented Feb 26, 2024

Seems there is a failed test about model deployment. I think this is a flaky test not related to code changes here.

For bwc failures, it's not related to code changes here neither. We can find the same failure in #602

Signed-off-by: zhichao-aws <zhichaog@amazon.com>
Signed-off-by: zhichao-aws <zhichaog@amazon.com>
Signed-off-by: zhichao-aws <zhichaog@amazon.com>
@zhichao-aws zhichao-aws force-pushed the visitor_add_null_check branch from 571d4f4 to 38eda5f Compare February 28, 2024 02:01
@zhichao-aws
Copy link
Member Author

rebase main

@zhichao-aws zhichao-aws reopened this Feb 28, 2024
@zhichao-aws
Copy link
Member Author

All checks have passed. @vibrantvarun Could you please help review this and #614 ?

@zane-neo zane-neo merged commit b97dbe8 into opensearch-project:main Feb 29, 2024
118 checks passed
@zane-neo zane-neo added the backport 2.x Label will add auto workflow to backport PR to 2.x branch label Feb 29, 2024
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.x 2.x
# Navigate to the new working tree
cd .worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-615-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 b97dbe80f0b1dd8578a2dcdbed702c7660849747
# Push it to GitHub
git push --set-upstream origin backport/backport-615-to-2.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-615-to-2.x.

zhichao-aws added a commit to zhichao-aws/neural-search that referenced this pull request Feb 29, 2024
…ssor (opensearch-project#615)

* fix: add non-null check in NeuralQueryEnricherProcessor

Signed-off-by: zhichao-aws <zhichaog@amazon.com>

* add change log

Signed-off-by: zhichao-aws <zhichaog@amazon.com>

* optimize assert in ut

Signed-off-by: zhichao-aws <zhichaog@amazon.com>

---------

Signed-off-by: zhichao-aws <zhichaog@amazon.com>
(cherry picked from commit b97dbe8)
vibrantvarun pushed a commit that referenced this pull request Mar 4, 2024
…yEnricherProcessor (#619)

* [Fix] add non-null check for queryBuilder in NeuralQueryEnricherProcessor (#615)

* fix: add non-null check in NeuralQueryEnricherProcessor

Signed-off-by: zhichao-aws <zhichaog@amazon.com>

* add change log

Signed-off-by: zhichao-aws <zhichaog@amazon.com>

* optimize assert in ut

Signed-off-by: zhichao-aws <zhichaog@amazon.com>

---------

Signed-off-by: zhichao-aws <zhichaog@amazon.com>
(cherry picked from commit b97dbe8)

* update pr number

Signed-off-by: zhichao-aws <zhichaog@amazon.com>

* fix test compile

Signed-off-by: zhichao-aws <zhichaog@amazon.com>

---------

Signed-off-by: zhichao-aws <zhichaog@amazon.com>
yuye-aws pushed a commit to yuye-aws/neural-search that referenced this pull request Mar 8, 2024
…ssor (opensearch-project#615)

* fix: add non-null check in NeuralQueryEnricherProcessor

Signed-off-by: zhichao-aws <zhichaog@amazon.com>

* add change log

Signed-off-by: zhichao-aws <zhichaog@amazon.com>

* optimize assert in ut

Signed-off-by: zhichao-aws <zhichaog@amazon.com>

---------

Signed-off-by: zhichao-aws <zhichaog@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Label will add auto workflow to backport PR to 2.x branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants