Skip to content

Commit 26ace48

Browse files
committed
change syntax to "lower..upper"
1 parent fb07bec commit 26ace48

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

x-pack/plugin/esql/qa/testFixtures/src/main/java/org/elasticsearch/xpack/esql/CsvTestUtils.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -624,11 +624,12 @@ Object convert(String value) {
624624
if (value == null) {
625625
return null;
626626
}
627-
if (Number.class.isAssignableFrom(clazz) && value.startsWith("<") && value.endsWith(">") && value.contains(";")) {
628-
// Numbers of the form "<lower;upper>" are parsed to a Range.
629-
int separator = value.indexOf(';');
630-
Object lowerBound = converter.apply(value.substring(1, separator).trim());
631-
Object upperBound = converter.apply(value.substring(separator + 1, value.length() - 1).trim());
627+
if (Number.class.isAssignableFrom(clazz) && value.contains("..")) {
628+
// Numbers of the form "lower..upper" are parsed to a Range, indicating that
629+
// the expected value is within that range.
630+
int separator = value.indexOf("..");
631+
Object lowerBound = converter.apply(value.substring(0, separator).trim());
632+
Object upperBound = converter.apply(value.substring(separator + 2).trim());
632633
return new Range(lowerBound, upperBound);
633634
} else {
634635
return converter.apply(value);

x-pack/plugin/esql/qa/testFixtures/src/main/resources/sample.csv-spec

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ FROM employees
4141
;
4242

4343
count:long | avg_emp_no:double | sum_emp_no:long
44-
<10;90> | <10010.0;10090.0> | <100100;908100>
44+
10..90 | 10010.0..10090.0 | 100100..908100
4545
;
4646

4747

@@ -55,7 +55,7 @@ FROM employees
5555
;
5656

5757
count:long | avg_emp_no:double
58-
<2;48> | <10055;10095>
58+
2..48 | 10055..10095
5959
;
6060

6161

@@ -69,7 +69,7 @@ FROM employees
6969
;
7070

7171
count:long | avg_emp_no:double
72-
<2;48> | <10005;10045>
72+
2..48 | 10005..10045
7373
;
7474

7575

@@ -83,7 +83,7 @@ FROM employees
8383
;
8484

8585
count:long | avg_emp_no:double
86-
<10;90> | <10010;10090>
86+
10..90 | 10010..10090
8787
;
8888

8989

@@ -97,7 +97,7 @@ FROM employees
9797
;
9898

9999
count:long | avg_emp_no:double
100-
<10;90> | <10010;10090>
100+
10..90 | 10010..10090
101101
;
102102

103103

@@ -125,7 +125,7 @@ FROM employees
125125
;
126126

127127
count:long
128-
<2;48>
128+
2..48
129129
;
130130

131131

@@ -173,7 +173,7 @@ FROM employees
173173
;
174174

175175
count:long | avg_emp_no:double
176-
<10;90> | <10010;10090>
176+
10..90 | 10010..10090
177177
;
178178

179179

@@ -188,7 +188,7 @@ FROM employees
188188
;
189189

190190
count:long | avg_avg_salary:double
191-
<1;16> | <25000;75000>
191+
1..16 | 25000..75000
192192
;
193193

194194

0 commit comments

Comments
 (0)