Skip to content

Commit fb07bec

Browse files
committed
allow negative numbers
1 parent 6983fcd commit fb07bec

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -624,9 +624,9 @@ 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('-');
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(';');
630630
Object lowerBound = converter.apply(value.substring(1, separator).trim());
631631
Object upperBound = converter.apply(value.substring(separator + 1, value.length() - 1).trim());
632632
return new Range(lowerBound, upperBound);

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

Lines changed: 9 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-10090> | <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

@@ -220,6 +220,7 @@ emp_no:integer
220220
sampleStatsEval
221221
required_capability: fix_no_columns
222222
required_capability: sample_v3
223+
223224
FROM employees | SAMPLE 0.5 | LIMIT 10 | STATS count = COUNT() | EVAL is_expected = count > 0;
224225

225226
count:long | is_expected:boolean

0 commit comments

Comments
 (0)