mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-28 09:28:55 -04:00
[ES|QL] Change rounding mode in tests to HALF_DOWN (#129895)
The current rounding mode in some of the tests in ESQL uses DOWN which truncates more than rounds and can result in some tests failing with errors like `row 0 column 0:0: expected <0.05235999> but was <0.05236>` HALF_DOWN would round this up
This commit is contained in:
parent
d3049e03e1
commit
c94bd1cf24
1 changed files with 2 additions and 2 deletions
|
@ -371,9 +371,9 @@ public abstract class EsqlSpecTestCase extends ESRestTestCase {
|
|||
}
|
||||
return values;
|
||||
} else if (value instanceof Double d) {
|
||||
return new BigDecimal(d).round(new MathContext(7, RoundingMode.DOWN)).doubleValue();
|
||||
return new BigDecimal(d).round(new MathContext(7, RoundingMode.HALF_DOWN)).doubleValue();
|
||||
} else if (value instanceof String s) {
|
||||
return new BigDecimal(s).round(new MathContext(7, RoundingMode.DOWN)).doubleValue();
|
||||
return new BigDecimal(s).round(new MathContext(7, RoundingMode.HALF_DOWN)).doubleValue();
|
||||
}
|
||||
}
|
||||
if (type == CsvTestUtils.Type.TEXT || type == CsvTestUtils.Type.KEYWORD || type == CsvTestUtils.Type.SEMANTIC_TEXT) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue