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 hashCode values of aggregations' BytesValues. #5006

Closed

Conversation

jpountz
Copy link
Contributor

@jpountz jpountz commented Feb 4, 2014

This commit removes FilterBytesValues which is very trappy as the default
implementation forwards all method calls to the delegate. So if you do any
non-trivial modification to the terms or to the order of the terms, you need
to remember to override currentValueHash, copyShared, and this is very
error-prone.

FieldDataSource.WithScript.BytesValues and ScriptBytesValues now return correct
hash codes, future bugs here would be catched by the new assertion in
SortedUniqueBytesValues.

This bug was causing performance issues with scripts as all terms were assumed
to have the same hash code.

Close #5004

This commit removes FilterBytesValues which is very trappy as the default
implementation forwards all method calls to the delegate. So if you do any
non-trivial modification to the terms or to the order of the terms, you need
to remember to override currentValueHash, copyShared, and this is very
error-prone.

FieldDataSource.WithScript.BytesValues and ScriptBytesValues now return correct
hash codes, future bugs here would be catched by the new assertion in
SortedUniqueBytesValues.

This bug was causing performance issues with scripts as all terms were assumed
to have the same hash code.

Close elastic#5004
@s1monw
Copy link
Contributor

s1monw commented Feb 4, 2014

the fix LGTM can we have a test somehow that catches this?

@jpountz
Copy link
Contributor Author

jpountz commented Feb 4, 2014

Added tests.

@s1monw
Copy link
Contributor

s1monw commented Feb 4, 2014

LGTM Thanks for the test

@jpountz jpountz closed this Feb 4, 2014
@jpountz jpountz deleted the fix/aggregations_bytesvalues_hashcode branch February 4, 2014 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ScriptBytesValues.currentValueHash is wrong
3 participants