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

LUCENE-10530: Avoid floating point precision bug in TestTaxonomyFacetAssociations #848

Merged
merged 2 commits into from
Apr 29, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -500,10 +500,7 @@ private void validateFloats(
assertNull(facetResult);
} else {
assertEquals(dim, facetResult.dim);
// We can expect the floats to be exactly equal here since we're ensuring that we sum them
// in the same order when determining expected values and when computing facets. See
// LUCENE-10530:
assertEquals(aggregatedValue, facetResult.value.floatValue(), 0f);
assertEquals(aggregatedValue, facetResult.value.floatValue(), 1f);
Copy link
Contributor

Choose a reason for hiding this comment

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

+1, I was going to comment this in the last iteration. There may also be some internal drift in the way aggregation function works on floats. Found a nice read on it here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for sharing!

assertEquals(expected.size(), facetResult.childCount);
}
}
Expand Down