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 failure in InnerHitBuilderTests around 'fields' option. #62341

Merged
merged 1 commit into from
Sep 14, 2020

Conversation

jtibshirani
Copy link
Contributor

The case InnerHitBuilderTests#testEqualsAndHashcode creates a copy of the object
by serializing + deserializing it, then applies a modification. If the 'fields'
list is empty, then deserializing it results in Collections.emptyList. Because
this is immutable, then modifying it can throw an UnsupportedOperationException.

This PR takes the same approach as for docvalue_fields, where we create a new
list instead of trying to add to an empty one.

The case InnerHitBuilderTests#testEqualsAndHashcode creates a copy of the object
by serializing + deserializing it, then applies a modification. If the 'fields'
list is empty, then deserializing it results in Collections.emptyList. Because
this is immutable, then modifying it can throw an UnsupportedOperationException.

This PR takes the same approach as for docvalue_fields, where we create a new
list instead of trying to add to an empty one.
@jtibshirani jtibshirani added >non-issue :Search/Search Search-related issues that do not fall into other categories v8.0.0 v7.10.0 labels Sep 14, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search (:Search/Search)

@elasticmachine elasticmachine added the Team:Search Meta label for search team label Sep 14, 2020
@jtibshirani
Copy link
Contributor Author

Example test failure:

./gradlew ':server:test' --tests "org.elasticsearch.index.query.InnerHitBuilderTests.testEqualsAndHashcode" -Dtests.seed=6D21FA62063603D4 -Dtests.security.manager=true -Dtests.locale=ar-DZ -Dtests.timezone=America/Indiana/Vevay -Druntime.java=11

Copy link
Contributor

@jimczi jimczi left a comment

Choose a reason for hiding this comment

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

lgtm

@jtibshirani jtibshirani merged commit c1d9037 into elastic:master Sep 14, 2020
@jtibshirani jtibshirani deleted the inner-hit-builder branch September 14, 2020 21:45
@jtibshirani
Copy link
Contributor Author

Thanks for the review !

jtibshirani added a commit to jtibshirani/elasticsearch that referenced this pull request Sep 14, 2020
…62341)

The case InnerHitBuilderTests#testEqualsAndHashcode creates a copy of the object
by serializing + deserializing it, then applies a modification. If the 'fields'
list is empty, then deserializing it results in Collections.emptyList. Because
this is immutable, then modifying it can throw an UnsupportedOperationException.

This PR takes the same approach as for docvalue_fields, where we create a new
list instead of trying to add to an empty one.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>non-issue :Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team v7.10.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants