Skip to content

Commit d62be0f

Browse files
authored
ESQL: Make Categorize usable in aggs when identical to a grouping (#117835) (#117895)
Cases like `STATS MV_APPEND(cat, CATEGORIZE(x)) BY cat=CATEGORIZE(x)` should work, as they're moved to an EVAL by a rule. Also, these cases were discarded, as they fail because of other verifications (Which also fail for BUCKET): ``` STATS x = category BY category=CATEGORIZE(message) STATS x = CATEGORIZE(message) BY CATEGORIZE(message) STATS x = CATEGORIZE(message) BY category=CATEGORIZE(message)
1 parent 1474b8b commit d62be0f

File tree

9 files changed

+167
-78
lines changed

9 files changed

+167
-78
lines changed

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,27 @@ FROM employees
503503
//end::reuseGroupingFunctionWithExpression-result[]
504504
;
505505

506+
reuseGroupingFunctionImplicitAliasWithExpression#[skip:-8.13.99, reason:BUCKET renamed in 8.14]
507+
FROM employees
508+
| STATS s1 = `BUCKET(salary / 100 + 99, 50.)` + 1, s2 = BUCKET(salary / 1000 + 999, 50.) + 2 BY BUCKET(salary / 100 + 99, 50.), b2 = BUCKET(salary / 1000 + 999, 50.)
509+
| SORT `BUCKET(salary / 100 + 99, 50.)`, b2
510+
| KEEP s1, `BUCKET(salary / 100 + 99, 50.)`, s2, b2
511+
;
512+
513+
s1:double | BUCKET(salary / 100 + 99, 50.):double | s2:double | b2:double
514+
351.0 |350.0 |1002.0 |1000.0
515+
401.0 |400.0 |1002.0 |1000.0
516+
451.0 |450.0 |1002.0 |1000.0
517+
501.0 |500.0 |1002.0 |1000.0
518+
551.0 |550.0 |1002.0 |1000.0
519+
601.0 |600.0 |1002.0 |1000.0
520+
601.0 |600.0 |1052.0 |1050.0
521+
651.0 |650.0 |1052.0 |1050.0
522+
701.0 |700.0 |1052.0 |1050.0
523+
751.0 |750.0 |1052.0 |1050.0
524+
801.0 |800.0 |1052.0 |1050.0
525+
;
526+
506527
reuseGroupingFunctionWithinAggs#[skip:-8.13.99, reason:BUCKET renamed in 8.14]
507528
FROM employees
508529
| STATS sum = 1 + MAX(1 + BUCKET(salary, 1000.)) BY BUCKET(salary, 1000.) + 1

0 commit comments

Comments
 (0)