Repository navigation
Commit 1c73d49
committed
[fix](function) Stop InferAggNotNull from hiding an invalid top-K count
min_topk/max_topk implemented NullIgnoringAggregateFunction, whose contract says that an input
consisting only of rows with a NULL argument must behave like an empty input. That is false when
the count is a constant expression the FE cannot fold: BE validates it per input row, so an
all-NULL value column still has to reach the aggregate. InferAggNotNull inserted an x IS NOT NULL
filter below the global aggregate instead, folded the input to empty, and the invalid count
silently returned an empty array.
Key changes:
- Drop the marker from TopKFunction; NULL x values are still skipped by add, which runs after the
count validation
- Cover the all-NULL global input with a non-literal NULL count (now fails) and with a valid
non-literal count (still returns an empty array)
Unit Test:
- regression-test/suites/query_p0/aggregate/min_max_topk.groovy1 parent 51bd4e1 commit 1c73d49
3 files changed
Lines changed: 32 additions & 1 deletion
File tree
- fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/agg
- regression-test
- data/query_p0/aggregate
- suites/query_p0/aggregate
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
48 | 54 | | |
49 | 55 | | |
50 | | - | |
| 56 | + | |
51 | 57 | | |
52 | 58 | | |
53 | 59 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
198 | 220 | | |
199 | 221 | | |
200 | 222 | | |
| |||
0 commit comments