Skip to content

Commit 6bbd203

Browse files
committed
Rename capability CATEGORIZE_V3
1 parent ee0d528 commit 6bbd203

File tree

3 files changed

+42
-42
lines changed

3 files changed

+42
-42
lines changed

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

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
standard aggs
2-
required_capability: categorize_v2
2+
required_capability: categorize_v3
33

44
FROM sample_data
55
| STATS count=COUNT(),
@@ -17,7 +17,7 @@ count:long | sum:long | avg:double | count_distinct:long | category:keyw
1717
;
1818

1919
values aggs
20-
required_capability: categorize_v2
20+
required_capability: categorize_v3
2121

2222
FROM sample_data
2323
| STATS values=MV_SORT(VALUES(message)),
@@ -33,7 +33,7 @@ values:keyword | top
3333
;
3434

3535
mv
36-
required_capability: categorize_v2
36+
required_capability: categorize_v3
3737

3838
FROM mv_sample_data
3939
| STATS COUNT(), SUM(event_duration) BY category=CATEGORIZE(message)
@@ -48,7 +48,7 @@ COUNT():long | SUM(event_duration):long | category:keyword
4848
;
4949

5050
row mv
51-
required_capability: categorize_v2
51+
required_capability: categorize_v3
5252

5353
ROW message = ["connected to a", "connected to b", "disconnected"], str = ["a", "b", "c"]
5454
| STATS COUNT(), VALUES(str) BY category=CATEGORIZE(message)
@@ -61,7 +61,7 @@ COUNT():long | VALUES(str):keyword | category:keyword
6161
;
6262

6363
skips stopwords
64-
required_capability: categorize_v2
64+
required_capability: categorize_v3
6565

6666
ROW message = ["Mon Tue connected to a", "Jul Aug connected to b September ", "UTC connected GMT to c UTC"]
6767
| STATS COUNT() BY category=CATEGORIZE(message)
@@ -73,7 +73,7 @@ COUNT():long | category:keyword
7373
;
7474

7575
with multiple indices
76-
required_capability: categorize_v2
76+
required_capability: categorize_v3
7777
required_capability: union_types
7878

7979
FROM sample_data*
@@ -88,7 +88,7 @@ COUNT():long | category:keyword
8888
;
8989

9090
mv with many values
91-
required_capability: categorize_v2
91+
required_capability: categorize_v3
9292

9393
FROM employees
9494
| STATS COUNT() BY category=CATEGORIZE(job_positions)
@@ -106,7 +106,7 @@ COUNT():long | category:keyword
106106

107107
# Throws when calling AbstractCategorizeBlockHash.seenGroupIds() - Requires nulls support?
108108
mv with many values-Ignore
109-
required_capability: categorize_v2
109+
required_capability: categorize_v3
110110

111111
FROM employees
112112
| STATS SUM(languages) BY category=CATEGORIZE(job_positions)
@@ -121,7 +121,7 @@ SUM(languages):integer | category:keyword
121121
;
122122

123123
mv via eval
124-
required_capability: categorize_v2
124+
required_capability: categorize_v3
125125

126126
FROM sample_data
127127
| EVAL message = MV_APPEND(message, "Banana")
@@ -137,7 +137,7 @@ COUNT():long | category:keyword
137137
;
138138

139139
mv via eval const
140-
required_capability: categorize_v2
140+
required_capability: categorize_v3
141141

142142
FROM sample_data
143143
| EVAL message = ["Banana", "Bread"]
@@ -151,7 +151,7 @@ COUNT():long | category:keyword
151151
;
152152

153153
mv via eval const without aliases
154-
required_capability: categorize_v2
154+
required_capability: categorize_v3
155155

156156
FROM sample_data
157157
| EVAL message = ["Banana", "Bread"]
@@ -165,7 +165,7 @@ COUNT():long | CATEGORIZE(message):keyword
165165
;
166166

167167
mv const in parameter
168-
required_capability: categorize_v2
168+
required_capability: categorize_v3
169169

170170
FROM sample_data
171171
| STATS COUNT() BY c = CATEGORIZE(["Banana", "Bread"])
@@ -178,7 +178,7 @@ COUNT():long | c:keyword
178178
;
179179

180180
agg alias shadowing
181-
required_capability: categorize_v2
181+
required_capability: categorize_v3
182182

183183
FROM sample_data
184184
| STATS c = COUNT() BY c = CATEGORIZE(["Banana", "Bread"])
@@ -193,7 +193,7 @@ c:keyword
193193
;
194194

195195
chained aggregations using categorize
196-
required_capability: categorize_v2
196+
required_capability: categorize_v3
197197

198198
FROM sample_data
199199
| STATS COUNT() BY category=CATEGORIZE(message)
@@ -208,7 +208,7 @@ COUNT():long | category:keyword
208208
;
209209

210210
stats without aggs
211-
required_capability: categorize_v2
211+
required_capability: categorize_v3
212212

213213
FROM sample_data
214214
| STATS BY category=CATEGORIZE(message)
@@ -222,7 +222,7 @@ category:keyword
222222
;
223223

224224
text field
225-
required_capability: categorize_v2
225+
required_capability: categorize_v3
226226

227227
FROM hosts
228228
| STATS COUNT() BY category=CATEGORIZE(host_group)
@@ -235,7 +235,7 @@ COUNT():long | category:keyword
235235
2 | .*?servers.*?
236236
;
237237

238-
required_capability: categorize_v2
238+
required_capability: categorize_v3
239239

240240
FROM sample_data
241241
| STATS COUNT() BY category=CATEGORIZE(TO_UPPER(message))
@@ -249,7 +249,7 @@ COUNT():long | category:keyword
249249
;
250250

251251
on CONCAT
252-
required_capability: categorize_v2
252+
required_capability: categorize_v3
253253

254254
FROM sample_data
255255
| STATS COUNT() BY category=CATEGORIZE(CONCAT(message, " banana"))
@@ -263,7 +263,7 @@ COUNT():long | category:keyword
263263
;
264264

265265
on CONCAT with unicode
266-
required_capability: categorize_v2
266+
required_capability: categorize_v3
267267

268268
FROM sample_data
269269
| STATS COUNT() BY category=CATEGORIZE(CONCAT(message, " 👍🏽😊"))
@@ -277,7 +277,7 @@ COUNT():long | category:keyword
277277
;
278278

279279
on REVERSE(CONCAT())
280-
required_capability: categorize_v2
280+
required_capability: categorize_v3
281281

282282
FROM sample_data
283283
| STATS COUNT() BY category=CATEGORIZE(REVERSE(CONCAT(message, " 👍🏽😊")))
@@ -291,7 +291,7 @@ COUNT():long | category:keyword
291291
;
292292

293293
and then TO_LOWER
294-
required_capability: categorize_v2
294+
required_capability: categorize_v3
295295

296296
FROM sample_data
297297
| STATS COUNT() BY category=CATEGORIZE(message)
@@ -307,7 +307,7 @@ COUNT():long | category:keyword
307307

308308
# Throws NPE - Requires nulls support
309309
on const empty string-Ignore
310-
required_capability: categorize_v2
310+
required_capability: categorize_v3
311311

312312
FROM sample_data
313313
| STATS COUNT() BY category=CATEGORIZE("")
@@ -320,7 +320,7 @@ COUNT():long | category:keyword
320320

321321
# Throws NPE - Requires nulls support
322322
on const empty string from eval-Ignore
323-
required_capability: categorize_v2
323+
required_capability: categorize_v3
324324

325325
FROM sample_data
326326
| EVAL x = ""
@@ -334,7 +334,7 @@ COUNT():long | category:keyword
334334

335335
# Doesn't give the correct results - Requires nulls support
336336
on null-Ignore
337-
required_capability: categorize_v2
337+
required_capability: categorize_v3
338338

339339
FROM sample_data
340340
| EVAL x = null
@@ -348,7 +348,7 @@ COUNT():long | category:keyword
348348

349349
# Doesn't give the correct results - Requires nulls support
350350
on null string-Ignore
351-
required_capability: categorize_v2
351+
required_capability: categorize_v3
352352

353353
FROM sample_data
354354
| EVAL x = null::string
@@ -361,7 +361,7 @@ COUNT():long | category:keyword
361361
;
362362

363363
filtering out all data
364-
required_capability: categorize_v2
364+
required_capability: categorize_v3
365365

366366
FROM sample_data
367367
| WHERE @timestamp < "2023-10-23T00:00:00Z"
@@ -373,7 +373,7 @@ COUNT():long | category:keyword
373373
;
374374

375375
filtering out all data with constant
376-
required_capability: categorize_v2
376+
required_capability: categorize_v3
377377

378378
FROM sample_data
379379
| STATS COUNT() BY category=CATEGORIZE(message)
@@ -384,7 +384,7 @@ COUNT():long | category:keyword
384384
;
385385

386386
drop output columns
387-
required_capability: categorize_v2
387+
required_capability: categorize_v3
388388

389389
FROM sample_data
390390
| STATS count=COUNT() BY category=CATEGORIZE(message)
@@ -399,7 +399,7 @@ x:integer
399399
;
400400

401401
category value processing
402-
required_capability: categorize_v2
402+
required_capability: categorize_v3
403403

404404
ROW message = ["connected to a", "connected to b", "disconnected"]
405405
| STATS COUNT() BY category=CATEGORIZE(message)
@@ -413,7 +413,7 @@ COUNT():long | category:keyword
413413
;
414414

415415
row aliases
416-
required_capability: categorize_v2
416+
required_capability: categorize_v3
417417

418418
ROW message = "connected to xyz"
419419
| EVAL x = message
@@ -427,7 +427,7 @@ COUNT():long | category:keyword | y:keyword
427427
;
428428

429429
from aliases
430-
required_capability: categorize_v2
430+
required_capability: categorize_v3
431431

432432
FROM sample_data
433433
| EVAL x = message
@@ -443,7 +443,7 @@ COUNT():long | category:keyword | y:keyword
443443
;
444444

445445
row aliases with keep
446-
required_capability: categorize_v2
446+
required_capability: categorize_v3
447447

448448
ROW message = "connected to xyz"
449449
| EVAL x = message
@@ -459,7 +459,7 @@ COUNT():long | y:keyword
459459
;
460460

461461
from aliases with keep
462-
required_capability: categorize_v2
462+
required_capability: categorize_v3
463463

464464
FROM sample_data
465465
| EVAL x = message
@@ -477,7 +477,7 @@ COUNT():long | y:keyword
477477
;
478478

479479
row rename
480-
required_capability: categorize_v2
480+
required_capability: categorize_v3
481481

482482
ROW message = "connected to xyz"
483483
| RENAME message as x
@@ -491,7 +491,7 @@ COUNT():long | y:keyword
491491
;
492492

493493
from rename
494-
required_capability: categorize_v2
494+
required_capability: categorize_v3
495495

496496
FROM sample_data
497497
| RENAME message as x
@@ -507,7 +507,7 @@ COUNT():long | y:keyword
507507
;
508508

509509
row drop
510-
required_capability: categorize_v2
510+
required_capability: categorize_v3
511511

512512
ROW message = "connected to a"
513513
| STATS c = COUNT() BY category=CATEGORIZE(message)
@@ -520,7 +520,7 @@ c:long
520520
;
521521

522522
from drop
523-
required_capability: categorize_v2
523+
required_capability: categorize_v3
524524

525525
FROM sample_data
526526
| STATS c = COUNT() BY category=CATEGORIZE(message)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,10 +403,10 @@ public enum Cap {
403403
/**
404404
* Supported the text categorization function "CATEGORIZE".
405405
* <p>
406-
* This capability was initially named `CATEGORIZE`, and got renamed after the function started correctly returning keywords.
406+
* This capability was initially named `CATEGORIZE`, and got renamed after adding more BWC-breaking features.
407407
* </p>
408408
*/
409-
CATEGORIZE_V2(Build.current().isSnapshot()),
409+
CATEGORIZE_V3(Build.current().isSnapshot()),
410410

411411
/**
412412
* QSTR function

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/analysis/VerifierTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1846,7 +1846,7 @@ public void testIntervalAsString() {
18461846
}
18471847

18481848
public void testCategorizeSingleGrouping() {
1849-
assumeTrue("requires Categorize capability", EsqlCapabilities.Cap.CATEGORIZE_V2.isEnabled());
1849+
assumeTrue("requires Categorize capability", EsqlCapabilities.Cap.CATEGORIZE_V3.isEnabled());
18501850

18511851
query("from test | STATS COUNT(*) BY CATEGORIZE(first_name)");
18521852
query("from test | STATS COUNT(*) BY cat = CATEGORIZE(first_name)");
@@ -1875,7 +1875,7 @@ public void testCategorizeSingleGrouping() {
18751875
}
18761876

18771877
public void testCategorizeNestedGrouping() {
1878-
assumeTrue("requires Categorize capability", EsqlCapabilities.Cap.CATEGORIZE_V2.isEnabled());
1878+
assumeTrue("requires Categorize capability", EsqlCapabilities.Cap.CATEGORIZE_V3.isEnabled());
18791879

18801880
query("from test | STATS COUNT(*) BY CATEGORIZE(LENGTH(first_name)::string)");
18811881

@@ -1890,7 +1890,7 @@ public void testCategorizeNestedGrouping() {
18901890
}
18911891

18921892
public void testCategorizeWithinAggregations() {
1893-
assumeTrue("requires Categorize capability", EsqlCapabilities.Cap.CATEGORIZE_V2.isEnabled());
1893+
assumeTrue("requires Categorize capability", EsqlCapabilities.Cap.CATEGORIZE_V3.isEnabled());
18941894

18951895
query("from test | STATS MV_COUNT(cat), COUNT(*) BY cat = CATEGORIZE(first_name)");
18961896

0 commit comments

Comments
 (0)