Skip to content

Commit 238e422

Browse files
committed
Add comment to explain the normalisation choices
1 parent bba2f47 commit 238e422

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

test/framework/src/main/java/org/elasticsearch/datageneration/matchers/source/DynamicFieldMatcher.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ public MatchResult match(List<Object> actual, List<Object> expected) {
8989
return matchWithGenericMatcher(actual, expected);
9090
}
9191

92+
/**
93+
* We make the normalisation of double values stricter than {@link SourceTransforms#normalizeValues} to facilitate the equality of the
94+
* values within a margin of error. Synthetic source does support duplicate values and preserves the order, but it loses some accuracy,
95+
* this is why the margin of error is very important. In the future, we can make {@link SourceTransforms#normalizeValues} also stricter.
96+
*/
9297
private static List<Float> normalizeDoubles(List<Object> values) {
9398
if (values == null) {
9499
return List.of();

0 commit comments

Comments
 (0)