Skip to content

Commit 33c069e

Browse files
committed
Add new capability for BwC tests
1 parent 5f0f502 commit 33c069e

File tree

4 files changed

+39
-33
lines changed

4 files changed

+39
-33
lines changed

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ emp_no:integer | first_name:keyword | last_name:keyword
199199
;
200200

201201
testMatchIpField
202-
required_capability: match_function
202+
required_capability: match_additional_types
203203

204204
from clientips
205205
| where match(client_ip, "172.21.3.15");
@@ -209,7 +209,7 @@ client_ip:keyword | env:keyword
209209
;
210210

211211
testMatchDateField
212-
required_capability: match_function
212+
required_capability: match_additional_types
213213

214214
from date_nanos
215215
| where match(millis, "2023-10-23T13:55:01.543Z")
@@ -220,7 +220,7 @@ millis:date
220220
;
221221

222222
testMatchPartialDateField
223-
required_capability: match_function
223+
required_capability: match_additional_types
224224

225225
from date_nanos
226226
| where match(millis, "1999-10-22")
@@ -231,7 +231,7 @@ millis:date
231231
;
232232

233233
testMatchDateNanosField
234-
required_capability: match_function
234+
required_capability: match_additional_types
235235

236236
from date_nanos
237237
| where match(nanos, "2023-10-23T13:55:01.543123456Z")
@@ -242,7 +242,7 @@ nanos:date_nanos
242242
;
243243

244244
testMatchPartialDateNanosField
245-
required_capability: match_function
245+
required_capability: match_additional_types
246246

247247
from date_nanos
248248
| where match(nanos, "2023-10-23T13:55:01")
@@ -253,7 +253,7 @@ nanos:date_nanos
253253
;
254254

255255
testMatchBooleanField
256-
required_capability: match_function
256+
required_capability: match_additional_types
257257

258258
from employees
259259
| where match(still_hired, true) and height > 2.08
@@ -268,7 +268,7 @@ Amabile | true | 2.09
268268
;
269269

270270
testMatchIntegerField
271-
required_capability: match_function
271+
required_capability: match_additional_types
272272

273273
from employees
274274
| where match(emp_no, 10004)
@@ -279,7 +279,7 @@ emp_no:integer | first_name:keyword
279279
;
280280

281281
testMatchDoubleField
282-
required_capability: match_function
282+
required_capability: match_additional_types
283283

284284
from employees
285285
| where match(salary_change, 9.07)
@@ -290,7 +290,7 @@ emp_no:integer | salary_change:double
290290
;
291291

292292
testMatchDoubleField
293-
required_capability: match_function
293+
required_capability: match_additional_types
294294

295295
from employees
296296
| where match(salary_change, 9.07)
@@ -301,7 +301,7 @@ emp_no:integer | salary_change:double
301301
;
302302

303303
testMatchLongField
304-
required_capability: match_function
304+
required_capability: match_additional_types
305305

306306
from date_nanos
307307
| where match(num, 1698069301543123456)
@@ -312,7 +312,7 @@ num:long
312312
;
313313

314314
testMatchUnsignedLongField
315-
required_capability: match_function
315+
required_capability: match_additional_types
316316

317317
from ul_logs
318318
| where match(bytes_out, 12749081495402663265)
@@ -323,7 +323,7 @@ bytes_out:unsigned_long
323323
;
324324

325325
testMatchVersionField
326-
required_capability: match_function
326+
required_capability: match_additional_types
327327

328328
from apps
329329
| where match(version, "2.1")

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ count(*): long | author.keyword:keyword
219219
;
220220

221221
testMatchIpField
222-
required_capability: match_function
222+
required_capability: match_additional_types
223223

224224
from clientips
225225
| where client_ip:"172.21.3.15";
@@ -229,7 +229,7 @@ client_ip:keyword | env:keyword
229229
;
230230

231231
testMatchDateField
232-
required_capability: match_function
232+
required_capability: match_additional_types
233233

234234
from date_nanos
235235
| where millis:"2023-10-23T13:55:01.543Z"
@@ -240,7 +240,7 @@ millis:date
240240
;
241241

242242
testMatchPartialDateField
243-
required_capability: match_function
243+
required_capability: match_additional_types
244244

245245
from date_nanos
246246
| where millis:"1999-10-22"
@@ -251,7 +251,7 @@ millis:date
251251
;
252252

253253
testMatchDateNanosField
254-
required_capability: match_function
254+
required_capability: match_additional_types
255255

256256
from date_nanos
257257
| where nanos:"2023-10-23T13:55:01.543123456Z"
@@ -262,7 +262,7 @@ nanos:date_nanos
262262
;
263263

264264
testMatchPartialDateNanosField
265-
required_capability: match_function
265+
required_capability: match_additional_types
266266

267267
from date_nanos
268268
| where nanos:"2023-10-23T13:55:01"
@@ -273,7 +273,7 @@ nanos:date_nanos
273273
;
274274

275275
testMatchBooleanField
276-
required_capability: match_function
276+
required_capability: match_additional_types
277277

278278
from employees
279279
| where still_hired:true and height > 2.08
@@ -288,7 +288,7 @@ Amabile | true | 2.09
288288
;
289289

290290
testMatchIntegerField
291-
required_capability: match_function
291+
required_capability: match_additional_types
292292

293293
from employees
294294
| where emp_no:10004
@@ -299,7 +299,7 @@ emp_no:integer | first_name:keyword
299299
;
300300

301301
testMatchDoubleField
302-
required_capability: match_function
302+
required_capability: match_additional_types
303303

304304
from employees
305305
| where salary_change:9.07
@@ -310,7 +310,7 @@ emp_no:integer | salary_change:double
310310
;
311311

312312
testMatchDoubleField
313-
required_capability: match_function
313+
required_capability: match_additional_types
314314

315315
from employees
316316
| where salary_change:9.07
@@ -321,7 +321,7 @@ emp_no:integer | salary_change:double
321321
;
322322

323323
testMatchLongField
324-
required_capability: match_function
324+
required_capability: match_additional_types
325325

326326
from date_nanos
327327
| where num:1698069301543123456
@@ -332,7 +332,7 @@ num:long
332332
;
333333

334334
testMatchUnsignedLongField
335-
required_capability: match_function
335+
required_capability: match_additional_types
336336

337337
from ul_logs
338338
| where bytes_out:12749081495402663265
@@ -343,7 +343,7 @@ bytes_out:unsigned_long
343343
;
344344

345345
testMatchVersionField
346-
required_capability: match_function
346+
required_capability: match_additional_types
347347

348348
from apps
349349
| where version:"2.1"

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,12 @@ public enum Cap {
531531
/**
532532
* support for aggregations on semantic_text
533533
*/
534-
SEMANTIC_TEXT_AGGREGATIONS(EsqlCorePlugin.SEMANTIC_TEXT_FEATURE_FLAG);
534+
SEMANTIC_TEXT_AGGREGATIONS(EsqlCorePlugin.SEMANTIC_TEXT_FEATURE_FLAG),
535+
536+
/**
537+
* Additional types for match function and operator
538+
*/
539+
MATCH_ADDITIONAL_TYPES;
535540

536541
private final boolean enabled;
537542

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/fulltext/Match.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,15 @@ public String getWriteableName() {
116116

117117
@Override
118118
protected TypeResolution resolveNonQueryParamTypes() {
119-
return isNotNull(field, sourceText(), FIRST)
120-
.and(isType(
121-
field,
122-
DATA_TYPES::contains,
123-
sourceText(),
124-
FIRST,
125-
"keyword, text, boolean, date, date_nanos, double, integer, ip, long, unsigned_long, version"
126-
));
119+
return isNotNull(field, sourceText(), FIRST).and(
120+
isType(
121+
field,
122+
DATA_TYPES::contains,
123+
sourceText(),
124+
FIRST,
125+
"keyword, text, boolean, date, date_nanos, double, integer, ip, long, unsigned_long, version"
126+
)
127+
);
127128
}
128129

129130
@Override

0 commit comments

Comments
 (0)