Skip to content

Commit 4c986c3

Browse files
ivanceamatthewabbott
authored andcommitted
Reduce double and float precision requirements on rest CSV tests (elastic#114313)
Fixes elastic/elasticsearch-serverless#2837 The failing value is `5.801464200000001`, which rounds to `5.8014642`. However, `5.8014642` is roudned to `5.801464199`. With a precision of 7, both are truncated to `5.801464`. Not the most elegant solution, but it works for this case, which may be a quite edgy one.
1 parent 8d60324 commit 4c986c3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/EsqlSpecTestCase.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,9 @@ private Object valueMapper(CsvTestUtils.Type type, Object value) {
279279
}
280280
return values;
281281
} else if (value instanceof Double d) {
282-
return new BigDecimal(d).round(new MathContext(10, RoundingMode.DOWN)).doubleValue();
282+
return new BigDecimal(d).round(new MathContext(7, RoundingMode.DOWN)).doubleValue();
283283
} else if (value instanceof String s) {
284-
return new BigDecimal(s).round(new MathContext(10, RoundingMode.DOWN)).doubleValue();
284+
return new BigDecimal(s).round(new MathContext(7, RoundingMode.DOWN)).doubleValue();
285285
}
286286
}
287287
return value.toString();

0 commit comments

Comments
 (0)