Factor out filling of TopDocs in SearchPhaseController#23380
Merged
s1monw merged 2 commits intoelastic:masterfrom Feb 27, 2017
Merged
Factor out filling of TopDocs in SearchPhaseController#23380s1monw merged 2 commits intoelastic:masterfrom
s1monw merged 2 commits intoelastic:masterfrom
Conversation
Previously this code was duplicated across the 3 different topdocs variants we have. It also had no real unittest (where we tested with holes in the results) which caused a sneaky bug where the comparison used `result.size()` vs `results.size()` causing several NPEs downstream. This change adds a static method to fill the top docs that is shared across all variants and adds a unittest that would have caught the issue very quickly. Closes elastic#19356 Closes elastic#23357
jpountz
approved these changes
Feb 27, 2017
| Supplier<T> emptySupplier) { | ||
| if (results.size() != shardTopDocs.length) { | ||
| // TopDocs#merge can't deal with null shard TopDocs | ||
| final T empty = emptySupplier.get(); |
Contributor
There was a problem hiding this comment.
the supplier seems to be only useful to save one object allocation, maybe getting rid of it would make things simpler?
s1monw
added a commit
that referenced
this pull request
Feb 27, 2017
Previously this code was duplicated across the 3 different topdocs variants we have. It also had no real unittest (where we tested with holes in the results) which caused a sneaky bug where the comparison used `result.size()` vs `results.size()` causing several NPEs downstream. This change adds a static method to fill the top docs that is shared across all variants and adds a unittest that would have caught the issue very quickly. Closes #19356 Closes #23357
jasontedor
added a commit
to jasontedor/elasticsearch
that referenced
this pull request
Feb 27, 2017
* master: [TEST] make headers case-insensitive when running yaml tests [TEST] randomize request content_type between all of the supported formats [TEST] add support for binary responses to REST tests infra [TEST] don't check exact size in mapper-size yaml test [TEST] move test for binary field to specific test file that sets Content-Type header explicitly [TEST] move filters aggs wrapper query builder rewriting test to integ tests [TEST] create HttpEntity earlier in REST tests [TEST] Remove content type auto-detection while parsing request body in REST tests Factor out filling of TopDocs in SearchPhaseController (elastic#23380) Add info method to High Level Rest client (elastic#23350) Prevent negative `from` parameter in SearchSourceBuilder (elastic#23358) reduce the number of iterations in testPrimaryRelocationWhileIndexing and flush every 5 rollback unneeded change in testNotifyOnDisconnect disable sampling in testNotifyOnDisconnect
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously this code was duplicated across the 3 different topdocs variants
we have. It also had no real unittest (where we tested with holes in the results)
which caused a sneaky bug where the comparison used
result.size()vsresults.size()causing several NPEs downstream. This change adds a static method to fill the top docs
that is shared across all variants and adds a unittest that would have caught the issue
very quickly.
Closes #19356
Closes #23357