Repository navigation
Commit 232ef31
committed
[fix](fe) Keep the literals of a grouping definition in the learned key
### What problem does this solve?
Problem Summary: a grouping key which names a definition of the sub tree is rendered in the key of the
aggregation, and the literal mode folded the literals of that definition. The learned (constant
agnostic) key of
Aggregate(group by x) <- Project(a % n AS x) <- Scan(t)
was therefore one for `n = 2` and for `n = 1000`, although with unchanged a = 0..999 the first produces
2 groups and the second 1000. The learned input matching only compares the scans (unchanged here), so a
count collected for the first query was applied to the second.
The grouping keys of an aggregation now keep their literals in both modes, exactly like the conditions
of a join: a definition inside a key decides the number of groups, so it cannot be folded. The
aggregation header is protected as well, so the fold of a pasted struct info copies it verbatim. A
grouping key without a literal (a plain column) renders as before.
### Release note
A learned hbo statistics entry of an aggregation is no longer applied to a query with another grouping
definition.
### Check List (For Author)
- Test: Unit Test
- The two corpus cases `aggregate_grouping_by_a_computed_project` and
`aggregate_grouping_by_another_computed_project` now differ in their constant agnostic keys, and a
test pins that the definition is part of that key. The regenerated file moves only those two
agnostic keys (the intended change); 197 cases of the stats package plus the HBO command suite
pass.
- Behavior changed: Yes - the constant agnostic key of an aggregation keeps the literals of its
grouping keys.
- Does this need documentation: No1 parent 8288527 commit 232ef31
3 files changed
Lines changed: 42 additions & 11 deletions
File tree
- fe/fe-core/src
- main/java/org/apache/doris/nereids/stats
- test
- java/org/apache/doris/nereids/stats
- resources
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1018 | 1018 | | |
1019 | 1019 | | |
1020 | 1020 | | |
1021 | | - | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
1022 | 1025 | | |
1023 | 1026 | | |
1024 | 1027 | | |
| |||
1630 | 1633 | | |
1631 | 1634 | | |
1632 | 1635 | | |
1633 | | - | |
| 1636 | + | |
1634 | 1637 | | |
1635 | 1638 | | |
1636 | 1639 | | |
| |||
1715 | 1718 | | |
1716 | 1719 | | |
1717 | 1720 | | |
| 1721 | + | |
| 1722 | + | |
| 1723 | + | |
| 1724 | + | |
| 1725 | + | |
| 1726 | + | |
| 1727 | + | |
| 1728 | + | |
| 1729 | + | |
| 1730 | + | |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
| 1734 | + | |
| 1735 | + | |
1718 | 1736 | | |
1719 | 1737 | | |
1720 | 1738 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
494 | 494 | | |
495 | 495 | | |
496 | 496 | | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
497 | 510 | | |
498 | 511 | | |
499 | 512 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
99 | | - | |
100 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | | - | |
111 | | - | |
112 | | - | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
122 | | - | |
123 | | - | |
124 | | - | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| |||
0 commit comments