Repository navigation
Commit 0ac4c9c
committed
fix: skip WindowTopN rewrite when fetch is 0 to avoid PartitionedTopK panic
A predicate like `rn < 1` (or the flipped `1 > rn`) makes the WindowTopN
rule compute a fetch of 0. Since ROW_NUMBER/RANK are always >= 1, no row can
satisfy such a predicate and the correct result is empty. The rule passed
fetch = 0 to `PartitionedTopKExec::try_new`, whose `assert!(k > 0)` panicked.
Bail out of the rewrite when the computed limit is 0 and let the regular
FilterExec produce the (empty) result instead.
Closes apache#24404
Co-authored-by: Claude Code1 parent e7e037d commit 0ac4c9c
2 files changed
Lines changed: 32 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
144 | 153 | | |
145 | 154 | | |
146 | 155 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
87 | 110 | | |
88 | 111 | | |
89 | 112 | | |
| |||
0 commit comments