Skip to content

Commit 6983fcd

Browse files
committed
fix csv rest tests
1 parent e64757a commit 6983fcd

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,9 @@ private Object valueMapper(CsvTestUtils.Type type, Object value) {
380380
if (value == null) {
381381
return "null";
382382
}
383+
if (value instanceof CsvTestUtils.Range) {
384+
return value;
385+
}
383386
if (type == CsvTestUtils.Type.GEO_POINT || type == CsvTestUtils.Type.CARTESIAN_POINT) {
384387
// Point tests are failing in clustered integration tests because of tiny precision differences at very small scales
385388
if (value instanceof String wkt) {
@@ -421,6 +424,17 @@ private Object valueMapper(CsvTestUtils.Type type, Object value) {
421424
}
422425
}
423426
}
427+
if (type == CsvTestUtils.Type.DOUBLE || type == CsvTestUtils.Type.INTEGER || type == CsvTestUtils.Type.LONG) {
428+
if (value instanceof List<?> vs) {
429+
return vs.stream().map(v -> valueMapper(type, v)).toList();
430+
} else if (type == CsvTestUtils.Type.DOUBLE) {
431+
return ((Number) value).doubleValue();
432+
} else if (type == CsvTestUtils.Type.INTEGER) {
433+
return ((Number) value).intValue();
434+
} else if (type == CsvTestUtils.Type.LONG) {
435+
return ((Number) value).longValue();
436+
}
437+
}
424438
return value.toString();
425439
}
426440

0 commit comments

Comments
 (0)