-
Notifications
You must be signed in to change notification settings - Fork 24.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
Avoid precision loss in DocValueFormat.RAW#parseLong #49063
Conversation
Pinging @elastic/es-analytics-geo (:Analytics/Aggregations) |
@not-napoleon you might have a better handle on this area than me, would you mind reviewing? ❤️ |
@elasticmachine test this please |
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.
This looks fine to me, but I do wonder if there was some reason we weren't doing this in the first place. @jpountz I think you originally wrote this, do you know of some reason we wouldn't want to try parsing as a long first before falling back to rounding?
expectThrows(IllegalArgumentException.class, () -> DocValueFormat.RAW.parseLong("", randomBoolean(), null)); | ||
expectThrows(IllegalArgumentException.class, () -> DocValueFormat.RAW.parseLong("abc", randomBoolean(), null)); | ||
expectThrows(IllegalArgumentException.class, () -> DocValueFormat.RAW.parseDouble("", randomBoolean(), null)); | ||
expectThrows(IllegalArgumentException.class, () -> DocValueFormat.RAW.parseDouble("abc", randomBoolean(), 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.
Nice catch, thanks!
@not-napoleon No good reason, this is a true bug. :) |
@elasticmachine run elasticsearch-ci/1 |
The 6.8 branch is still maintained, right? Could this fix be backported to that branch as well please? |
fixes #38692