Commit 5b0fdcc
[ESQL] Add warnings on STATS alias collisions (elastic#115660) (elastic#116248)
Fixes elastic#114970
Added the warnings in the `RemoveStatsOverride` LogicalPlan rule, which is the same one that's removing the duplicates.
Also, fixed the groupings parser, which was assigning, to each stats grouping field, the source of the full "grouping context" instead. Without this fix, the warnings on groupings would, in some cases, say something like `Line 2:10: Field 'x' shadowed by field at line 2:10`.
As there are already tests for these cases, I'm requiring the capability on them, and updating their warnings expectations.
## Notes
I'm treating this as an enhancement instead of a bug. As there's existing logic removing duplicates, I'll guess this was decided at some point (Decision that may apply more or less nowadays).
And still, solving it this way is less dangerous and doesn't break compatibility.
Co-authored-by: Elastic Machine <[email protected]>1 parent 94498b4 commit 5b0fdcc
File tree
8 files changed
+73
-21
lines changed- x-pack/plugin/esql
- qa
- server/multi-clusters/src/javaRestTest/java/org/elasticsearch/xpack/esql/ccq
- testFixtures/src/main/resources
- src
- main/java/org/elasticsearch/xpack/esql
- action
- optimizer/rules/logical
- parser
- test/java/org/elasticsearch/xpack/esql
- analysis
- optimizer
8 files changed
+73
-21
lines changedLines changed: 6 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
42 | 41 | | |
43 | 42 | | |
44 | 43 | | |
| |||
231 | 230 | | |
232 | 231 | | |
233 | 232 | | |
234 | | - | |
| 233 | + | |
235 | 234 | | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
248 | 240 | | |
249 | 241 | | |
250 | 242 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
577 | 577 | | |
578 | 578 | | |
579 | 579 | | |
| 580 | + | |
580 | 581 | | |
581 | 582 | | |
582 | 583 | | |
| |||
587 | 588 | | |
588 | 589 | | |
589 | 590 | | |
| 591 | + | |
590 | 592 | | |
591 | 593 | | |
592 | 594 | | |
| |||
596 | 598 | | |
597 | 599 | | |
598 | 600 | | |
| 601 | + | |
599 | 602 | | |
600 | 603 | | |
601 | 604 | | |
| |||
607 | 610 | | |
608 | 611 | | |
609 | 612 | | |
| 613 | + | |
610 | 614 | | |
611 | 615 | | |
612 | 616 | | |
| |||
617 | 621 | | |
618 | 622 | | |
619 | 623 | | |
| 624 | + | |
620 | 625 | | |
621 | 626 | | |
622 | 627 | | |
| |||
628 | 633 | | |
629 | 634 | | |
630 | 635 | | |
| 636 | + | |
631 | 637 | | |
632 | 638 | | |
633 | 639 | | |
| |||
Lines changed: 26 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
509 | 509 | | |
510 | 510 | | |
511 | 511 | | |
| 512 | + | |
512 | 513 | | |
| 514 | + | |
513 | 515 | | |
514 | 516 | | |
515 | 517 | | |
| |||
533 | 535 | | |
534 | 536 | | |
535 | 537 | | |
| 538 | + | |
536 | 539 | | |
| 540 | + | |
| 541 | + | |
537 | 542 | | |
538 | 543 | | |
539 | 544 | | |
| |||
1582 | 1587 | | |
1583 | 1588 | | |
1584 | 1589 | | |
| 1590 | + | |
1585 | 1591 | | |
1586 | 1592 | | |
1587 | 1593 | | |
1588 | 1594 | | |
1589 | 1595 | | |
| 1596 | + | |
1590 | 1597 | | |
1591 | 1598 | | |
1592 | 1599 | | |
| |||
1623 | 1630 | | |
1624 | 1631 | | |
1625 | 1632 | | |
| 1633 | + | |
1626 | 1634 | | |
1627 | 1635 | | |
1628 | 1636 | | |
1629 | 1637 | | |
1630 | 1638 | | |
| 1639 | + | |
1631 | 1640 | | |
1632 | 1641 | | |
1633 | 1642 | | |
| |||
1638 | 1647 | | |
1639 | 1648 | | |
1640 | 1649 | | |
| 1650 | + | |
1641 | 1651 | | |
1642 | 1652 | | |
1643 | 1653 | | |
1644 | 1654 | | |
1645 | 1655 | | |
1646 | 1656 | | |
| 1657 | + | |
1647 | 1658 | | |
1648 | 1659 | | |
1649 | 1660 | | |
| |||
2013 | 2024 | | |
2014 | 2025 | | |
2015 | 2026 | | |
| 2027 | + | |
2016 | 2028 | | |
2017 | 2029 | | |
2018 | 2030 | | |
2019 | 2031 | | |
2020 | 2032 | | |
2021 | 2033 | | |
| 2034 | + | |
2022 | 2035 | | |
2023 | 2036 | | |
2024 | 2037 | | |
| |||
2030 | 2043 | | |
2031 | 2044 | | |
2032 | 2045 | | |
| 2046 | + | |
2033 | 2047 | | |
2034 | 2048 | | |
2035 | 2049 | | |
2036 | 2050 | | |
2037 | 2051 | | |
2038 | 2052 | | |
| 2053 | + | |
2039 | 2054 | | |
2040 | 2055 | | |
2041 | 2056 | | |
| |||
2193 | 2208 | | |
2194 | 2209 | | |
2195 | 2210 | | |
| 2211 | + | |
2196 | 2212 | | |
2197 | 2213 | | |
2198 | 2214 | | |
| 2215 | + | |
2199 | 2216 | | |
2200 | 2217 | | |
2201 | 2218 | | |
2202 | 2219 | | |
2203 | 2220 | | |
2204 | 2221 | | |
| 2222 | + | |
2205 | 2223 | | |
2206 | 2224 | | |
2207 | 2225 | | |
2208 | 2226 | | |
| 2227 | + | |
| 2228 | + | |
2209 | 2229 | | |
2210 | 2230 | | |
2211 | 2231 | | |
| |||
2214 | 2234 | | |
2215 | 2235 | | |
2216 | 2236 | | |
| 2237 | + | |
2217 | 2238 | | |
2218 | 2239 | | |
2219 | 2240 | | |
2220 | 2241 | | |
| 2242 | + | |
| 2243 | + | |
2221 | 2244 | | |
2222 | 2245 | | |
2223 | 2246 | | |
| |||
2227 | 2250 | | |
2228 | 2251 | | |
2229 | 2252 | | |
| 2253 | + | |
2230 | 2254 | | |
2231 | 2255 | | |
2232 | 2256 | | |
2233 | 2257 | | |
| 2258 | + | |
| 2259 | + | |
2234 | 2260 | | |
2235 | 2261 | | |
2236 | 2262 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
433 | 433 | | |
434 | 434 | | |
435 | 435 | | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
436 | 442 | | |
437 | 443 | | |
438 | 444 | | |
| |||
Lines changed: 16 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
| |||
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
45 | | - | |
| 47 | + | |
46 | 48 | | |
47 | 49 | | |
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
51 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
52 | 65 | | |
53 | 66 | | |
54 | 67 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
811 | 811 | | |
812 | 812 | | |
813 | 813 | | |
814 | | - | |
| 814 | + | |
815 | 815 | | |
816 | 816 | | |
817 | 817 | | |
| |||
Lines changed: 2 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
536 | 536 | | |
537 | 537 | | |
538 | 538 | | |
539 | | - | |
540 | | - | |
| 539 | + | |
541 | 540 | | |
542 | 541 | | |
543 | 542 | | |
544 | 543 | | |
545 | | - | |
| 544 | + | |
546 | 545 | | |
547 | 546 | | |
548 | 547 | | |
| |||
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
490 | 490 | | |
491 | 491 | | |
492 | 492 | | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
493 | 498 | | |
494 | 499 | | |
495 | 500 | | |
| |||
512 | 517 | | |
513 | 518 | | |
514 | 519 | | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
515 | 525 | | |
516 | 526 | | |
517 | 527 | | |
| |||
0 commit comments