-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Return null for aggregations factory even if empty aggs is present in search source #8206
Conversation
Gradle Check (Jenkins) Run Completed with:
|
server/src/main/java/org/opensearch/search/aggregations/AggregatorFactories.java
Show resolved
Hide resolved
rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/40_range.yml
Outdated
Show resolved
Hide resolved
Gradle Check (Jenkins) Run Completed with:
|
Codecov Report
@@ Coverage Diff @@
## main #8206 +/- ##
============================================
+ Coverage 70.93% 70.95% +0.01%
- Complexity 56636 56668 +32
============================================
Files 4719 4719
Lines 267559 267559
Branches 39206 39207 +1
============================================
+ Hits 189805 189850 +45
- Misses 61714 61731 +17
+ Partials 16040 15978 -62
|
… search source Signed-off-by: Jay Deng <jayd0104@gmail.com>
Flakey test from here is due to the change needing to be backported to 2.x as well. |
Gradle Check (Jenkins) Run Completed with:
|
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.
Nice way to add a test. Thank you for getting this in. I hope it gets approved ASAP.
I do not have approval rights on this repo, even though I am an Admin and accidentally approved it.
Gradle Check (Jenkins) Run Completed with:
|
rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/60_empty.yml
Outdated
Show resolved
Hide resolved
…regation/60_empty.yml Co-authored-by: Andriy Redko <drreta@gmail.com> Signed-off-by: Jay Deng <jayd0104@gmail.com>
@reta Applied your suggestion, I think we're good to merge then? Thanks! |
Gradle Check (Jenkins) Run Completed with:
|
… search source (#8206) * Return null for aggregations factory even if empty aggs is present in search source Signed-off-by: Jay Deng <jayd0104@gmail.com> * Update rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/60_empty.yml Co-authored-by: Andriy Redko <drreta@gmail.com> Signed-off-by: Jay Deng <jayd0104@gmail.com> --------- Signed-off-by: Jay Deng <jayd0104@gmail.com> Co-authored-by: Andriy Redko <drreta@gmail.com> (cherry picked from commit 049129c) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
… search source (#8206) (#8222) * Return null for aggregations factory even if empty aggs is present in search source * Update rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/60_empty.yml --------- (cherry picked from commit 049129c) Signed-off-by: Jay Deng <jayd0104@gmail.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Andriy Redko <drreta@gmail.com>
… search source (opensearch-project#8206) (opensearch-project#8222) * Return null for aggregations factory even if empty aggs is present in search source * Update rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/60_empty.yml --------- (cherry picked from commit 049129c) Signed-off-by: Jay Deng <jayd0104@gmail.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Andriy Redko <drreta@gmail.com>
… search source (opensearch-project#8206) * Return null for aggregations factory even if empty aggs is present in search source Signed-off-by: Jay Deng <jayd0104@gmail.com> * Update rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/60_empty.yml Co-authored-by: Andriy Redko <drreta@gmail.com> Signed-off-by: Jay Deng <jayd0104@gmail.com> --------- Signed-off-by: Jay Deng <jayd0104@gmail.com> Co-authored-by: Andriy Redko <drreta@gmail.com> Signed-off-by: Rishab Nahata <rnnahata@amazon.com>
… search source (opensearch-project#8206) * Return null for aggregations factory even if empty aggs is present in search source Signed-off-by: Jay Deng <jayd0104@gmail.com> * Update rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/60_empty.yml Co-authored-by: Andriy Redko <drreta@gmail.com> Signed-off-by: Jay Deng <jayd0104@gmail.com> --------- Signed-off-by: Jay Deng <jayd0104@gmail.com> Co-authored-by: Andriy Redko <drreta@gmail.com>
… search source (opensearch-project#8206) * Return null for aggregations factory even if empty aggs is present in search source Signed-off-by: Jay Deng <jayd0104@gmail.com> * Update rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/60_empty.yml Co-authored-by: Andriy Redko <drreta@gmail.com> Signed-off-by: Jay Deng <jayd0104@gmail.com> --------- Signed-off-by: Jay Deng <jayd0104@gmail.com> Co-authored-by: Andriy Redko <drreta@gmail.com> Signed-off-by: Shivansh Arora <hishiv@amazon.com>
Description
Whenever
"aggs"
is passed into the request body, even if it is empty (ex."aggs": {},
), then this line will evaluate to true:OpenSearch/server/src/main/java/org/opensearch/action/search/QueryPhaseResultConsumer.java
Line 117 in 8eea7b9
Causing us to go down the wrong path and hit the NPE.
This behavior exists from before #7514 and was handled by various checks for the aggregators, for example like here: https://github.com/opensearch-project/OpenSearch/blob/2.8/server/src/main/java/org/opensearch/search/aggregations/AggregationPhase.java#L68-L74 where collectors are not added if the aggregators length is not 0.
Related Issues
Resolves #8115
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.