Repository navigation
Commit d021cd9
fix: support untyped NULL input for median (apache#24104)
## Which issue does this PR close?
- Closes apache#24077.
## Rationale for this change
`median(NULL)` worked in DataFusion 53 but regressed in DataFusion 54.
The untyped NULL argument remained `DataType::Null`, causing physical
planning to create a median accumulator for an unsupported input type.
## What changes are included in this PR?
- Keep the existing declarative signature for `median`.
- Handle `DataType::Null` in physical execution using `NoopAccumulator`.
- Use a Null state field for Null input.
- Fall back to the generic groups accumulator adapter for Null input.
- Add a SQL logic regression test for `median(NULL)`.
## Are these changes tested?
Yes.
- `cargo fmt --all -- --check`
- `cargo test --profile=ci --test sqllogictests -- aggregate.slt`
- `cargo test -p datafusion-functions-aggregate`
- `cargo clippy -p datafusion-functions-aggregate --all-targets
--all-features -- -D warnings`
## Are there any user-facing changes?
Yes. `median(NULL)` now returns NULL with `DataType::Null` instead of
failing during physical execution.
---------
Co-authored-by: mazhengxuan <[email protected]>1 parent 4e77f21 commit d021cd9
2 files changed
Lines changed: 22 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| |||
138 | 139 | | |
139 | 140 | | |
140 | 141 | | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
141 | 153 | | |
142 | 154 | | |
143 | 155 | | |
| |||
174 | 186 | | |
175 | 187 | | |
176 | 188 | | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
177 | 193 | | |
178 | 194 | | |
179 | 195 | | |
| |||
192 | 208 | | |
193 | 209 | | |
194 | 210 | | |
195 | | - | |
| 211 | + | |
196 | 212 | | |
197 | 213 | | |
198 | 214 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1200 | 1200 | | |
1201 | 1201 | | |
1202 | 1202 | | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
1203 | 1208 | | |
1204 | 1209 | | |
1205 | 1210 | | |
| |||
0 commit comments