-
Notifications
You must be signed in to change notification settings - Fork 2.4k
fix issue 18446 NPE by making sure scoreSupplier.get() returns non-null scorer #19650
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 issue 18446 NPE by making sure scoreSupplier.get() returns non-null scorer #19650
Conversation
e325aab to
19d098a
Compare
|
❌ Gradle check result for 19d098a: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
|
Thanks @haruki1243, the spotlessJavaCheck gradle task failed, please run |
server/src/main/java/org/opensearch/common/lucene/search/function/ScriptScoreQuery.java
Show resolved
Hide resolved
4e4d047 to
29f7ccd
Compare
|
Thank you so much for your reply. I have made the requested changes, including apotless formatting, tests and changelog I added test cases to ScriptScoreQueryTests and ScriptScoreQueryIT. both pass. You can try to replace the implementation of ScriptScoreQuery with the old one, and you will see both of them fail. Regarding yaml rest tests, sorry I didn't find tests that uses script score in those yaml tests, and ScriptScoreQueryIT seems to be the right place for its integration test instead. |
|
❌ Gradle check result for 29f7ccd: null Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Looks like Jenkins is down <title>403 Forbidden</title> 403 Forbiddenjq: parse error: Invalid numeric literal at line 1, column 7 QUEUE_URL wait for jenkins to start workflow Check if queue exist in Jenkins after triggering Use queue information to find build number in Jenkins if available |
|
❌ Gradle check result for 29798e0: Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
…ll scorer Signed-off-by: Yao Zou <[email protected]>
29798e0 to
ff65f7e
Compare
Signed-off-by: Yao Zou <[email protected]> Signed-off-by: Andrew Ross <[email protected]>
ff65f7e to
9e69b55
Compare
|
❌ Gradle check result for 9e69b55: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #19650 +/- ##
============================================
+ Coverage 73.09% 73.20% +0.11%
- Complexity 71062 71224 +162
============================================
Files 5754 5766 +12
Lines 325260 325459 +199
Branches 47036 47080 +44
============================================
+ Hits 237736 238240 +504
+ Misses 68383 68084 -299
+ Partials 19141 19135 -6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@haruki1243 Thanks for fixing the issue. Could you please write a summary of the fix in the PR description like what changes specifically you made from the existing code to fix the issue. |
|
@haruki1243 Is this reproducible in 2.19 as well ? We might need to port it to a future Tagging @jainankitk for review. Looking at the stack trace, I'm wondering if the fix should be in Lucene. |
server/src/main/java/org/opensearch/common/lucene/search/function/ScriptScoreQuery.java
Show resolved
Hide resolved
jainankitk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was reviewing this change when I noticed that the PR was already merged. Couple of minor comments, but the change itself looks good to me. Also, I am still wondering about this comment #18446 (comment) regarding FunctionScoreQuery on the original issue
| } | ||
| boolean needsScore = scriptBuilder.needs_score(); | ||
| ScoreMode subQueryScoreMode = needsScore ? ScoreMode.COMPLETE : ScoreMode.COMPLETE_NO_SCORES; | ||
| Weight subQueryWeight = subQuery.createWeight(searcher, subQueryScoreMode, 1.0f); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we not using the boost? Is it because the boost is irrelevant for the subQuery?
| ScorerSupplier subQueryScorerSupplier = subQueryWeight.scorerSupplier(context); | ||
| if (subQueryScorerSupplier == null) { | ||
| return null; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensuring the subQueryScorerSupplier is non-null here helps make the ScorerSupplier implementation cleaner and easier.
| if (subQueryScorerSupplier == null) { | ||
| return null; | ||
| } | ||
| Weight weight = this; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I will probably decare subQueryScorerSupplier and weight as final.
It's not in 2.19 since it happens when opensearch upgrade lucene to version 10. It's not a bug in lucene, since in lucene there is a contract that the scorer from scorersupplier (something added in lucene 10) cannot be null. It is opensearch that violates such contract |
…ll scorer (#19650) * fix issue 18446 NPE by making sure scoreSupplier.get() returns non-null scorer Signed-off-by: Yao Zou <[email protected]> * add tests and changelog Signed-off-by: Yao Zou <[email protected]> Signed-off-by: Andrew Ross <[email protected]> --------- Signed-off-by: Yao Zou <[email protected]> Signed-off-by: Andrew Ross <[email protected]> Co-authored-by: Haruki <[email protected]> (cherry picked from commit 39b4a70) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
|
@asimmahmood1 Is there a 3.3 patch release planned? |
…ll scorer (opensearch-project#19650) * fix issue 18446 NPE by making sure scoreSupplier.get() returns non-null scorer Signed-off-by: Yao Zou <[email protected]> * add tests and changelog Signed-off-by: Yao Zou <[email protected]> Signed-off-by: Andrew Ross <[email protected]> --------- Signed-off-by: Yao Zou <[email protected]> Signed-off-by: Andrew Ross <[email protected]> Co-authored-by: Haruki <[email protected]>
Description
fix issue 18446 NPE by making sure scoreSupplier.get() returns non-null scorer
Related Issues
Resolves #[18446]
Check List
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.