kukanggg89 opened a new pull request, #55942: URL: https://github.com/apache/arrow/pull/55942
### Rationale for this change `ds.dataset()` infers the dataset schema from a single fragment when no schema is passed. A column that is all null in that fragment becomes null-typed for the whole dataset, and reading files where the column has values then fails with an ArrowTypeError. AlenkaF approved documenting this instead of changing the behavior in #27905. ### What changes are included in this PR? - python/pyarrow/dataset.py: the `schema` parameter of `dataset()` now notes the schema is inferred from a single fragment only, and that passing `schema` explicitly avoids the null-column problem. - docs/source/python/dataset.rst: a note plus a short example after the schema inference paragraph, showing a null-typed column from the first file and the same dataset with an explicit string schema. ### Are these changes tested? I did not run the test suite or the docs doctests here: this environment has no pyarrow install and the package needs the built C++ library. What I did check: `python -m py_compile` passes on the edited `dataset.py`, the example code parses, and the claims match the C++ source (`InspectOptions` in `cpp/src/arrow/dataset/discovery.h` defaults to inspecting one fragment) and the repro in #27905. The guide example still needs the docs build in CI to confirm it runs. ### Are there any user-facing changes? Yes. The `dataset()` docstring and the Dataset guide now document the schema inference behavior and the `schema=` workaround. No code behavior changes. ### Was AI used for this PR? Drafted with help from Claude. I reviewed and revised every change myself before opening this PR. **PR code and description written by:** - [ ] Human - [ ] AI **Reviewed before submission by:** - [ ] Human - [ ] AI - [ ] Not reviewed * GitHub Issue: (filled in automatically from the PR title; change "Closes" to "Refs" for a partial fix) -- 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]
