Skip to content

Commit d824faa

Browse files
committed
Replacing scores with round to avoid rounding errors
1 parent c3388de commit d824faa

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

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

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -71,22 +71,22 @@ required_capability: knn_function
7171
from colors metadata _score
7272
| where match(color, "violet") or knn(rgb_vector, [238,130,238], {"boost": 10.0, "k": 140})
7373
| sort _score desc
74-
| eval round_score = round(_score, 4)
74+
| eval round_score = round(_score)
7575
| keep color, rgb_vector, round_score
7676
| limit 10
7777
;
7878

7979
color:text | rgb_vector:dense_vector | round_score:double
80-
violet | [238.0, 130.0, 238.0] | 13.9457
81-
blue violet | [138.0, 43.0, 226.0] | 3.0877
82-
dark violet | [148.0, 0.0, 211.0] | 3.0877
83-
pale violet red | [219.0, 112.0, 147.0] | 2.5366
84-
medium violet red | [199.0, 21.0, 133.0] | 2.5359
85-
orchid | [218.0, 112.0, 214.0] | 0.0083
86-
plum | [221.0, 160.0, 221.0] | 0.0071
87-
hot pink | [255.0, 105.0, 180.0] | 0.0024
88-
thistle | [216.0, 191.0, 216.0] | 0.0021
89-
light pink | [255.0, 182.0, 193.0] | 0.0021
80+
violet | [238.0, 130.0, 238.0] | 14.0
81+
blue violet | [138.0, 43.0, 226.0] | 3.0
82+
dark violet | [148.0, 0.0, 211.0] | 3.0
83+
pale violet red | [219.0, 112.0, 147.0] | 3.0
84+
medium violet red | [199.0, 21.0, 133.0] | 3.0
85+
orchid | [218.0, 112.0, 214.0] | 0.0
86+
plum | [221.0, 160.0, 221.0] | 0.0
87+
hot pink | [255.0, 105.0, 180.0] | 0.0
88+
thistle | [216.0, 191.0, 216.0] | 0.0
89+
light pink | [255.0, 182.0, 193.0] | 0.0
9090
;
9191

9292
knnWithMultipleFunctions
@@ -95,14 +95,14 @@ required_capability: knn_function
9595
from colors metadata _score
9696
| where knn(rgb_vector, [128,128,0], {"k": 140}) and match(color, "olive")
9797
| sort _score desc
98-
| eval round_score = round(_score, 4)
98+
| eval round_score = round(_score)
9999
| keep color, rgb_vector, round_score
100100
;
101101

102102
color:text | rgb_vector:dense_vector | round_score:double
103-
olive | [128.0, 128.0, 0.0] | 5.4979
104-
olive drab | [107.0, 142.0, 35.0] | 3.5206
105-
dark olive green | [85.0, 107.0, 47.0] | 2.8906
103+
olive | [128.0, 128.0, 0.0] | 5.0
104+
olive drab | [107.0, 142.0, 35.0] | 4.0
105+
dark olive green | [85.0, 107.0, 47.0] | 3.0
106106
;
107107

108108
knnAfterKeep
@@ -247,13 +247,13 @@ required_capability: knn_function
247247
from colors metadata _score
248248
| where knn(rgb_vector, [128,128,0], {"k": 140, "similarity": 30}) or length(color) > 17
249249
| sort _score desc, color asc
250-
| eval round_score = round(_score, 4)
250+
| eval round_score = round(_score)
251251
| keep color, round_score
252252
;
253253

254254
color:text | round_score:double
255255
olive | 1.0
256-
olive drab | 0.0014
256+
olive drab | 0.0
257257
light golden rod yellow | 0.0
258258
medium aqua marine | 0.0
259259
medium spring green | 0.0
@@ -265,14 +265,14 @@ required_capability: knn_function
265265
from colors metadata _score
266266
| where (knn(rgb_vector, [128,128,0], {"k": 140, "similarity": 40}) and length(color) > 5) or (knn(rgb_vector, [128,0,128], {"k": 140, "similarity": 40}) and primary == false)
267267
| sort _score desc
268-
| eval round_score = round(_score, 4)
268+
| eval round_score = round(_score)
269269
| keep color, primary, round_score
270270
;
271271

272272
color:text | primary:boolean | round_score:double
273273
purple | false | 1.0
274-
dark magenta | false | 0.0045
275-
olive drab | false | 0.0014
274+
dark magenta | false | 0.0
275+
olive drab | false | 0.0
276276
;
277277

278278
testKnnInStatsNonPushable

0 commit comments

Comments
 (0)