09Catho opened a new pull request, #55791: URL: https://github.com/apache/arrow/pull/55791
### Rationale for this change `fill_null_forward` and `fill_null_backward` accept `pyarrow.Scalar` inputs through their Python wrappers, but currently return a one-element Array. On current main this path can also materialize the wrong value. A scalar has no null slots to fill, so it should be returned unchanged. ### What changes are included in this PR? The Python wrappers return scalar inputs unchanged and keep the existing C++ path for arrays and chunked arrays. The regression test covers numeric and null scalars for both forward and backward fill. ### Are these changes tested? - The PyArrow 26.0.1 wheel reproduced the return-type regression: `fill_null_forward(pa.scalar(5))` returned `Int64Array [5]` instead of a scalar. - A wrapper harness using the patched source passed for numeric and null scalars in both functions, and for existing array behavior. - `python -m compileall` passed for the changed files. - Ruff check passed with the repository's existing `PYI024` namedtuple warnings ignored. - `git diff --check` passed. - The source pytest module could not be collected because this shallow checkout has no compiled `pyarrow.lib` extension. ### Are there any user-facing changes? Yes. Scalar inputs now return the unchanged `pyarrow.Scalar`; array and chunked-array behavior is unchanged. ### Was AI used for this PR? AI was used to prepare the initial patch and regression tests. The change was checked against the issue reproduction and the available local validation before submission. **PR code and description written by:** - [ ] Human - [x] AI **Reviewed before submission by:** - [ ] Human - [x] AI - [ ] Not reviewed * GitHub Issue: #55760 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
