slachiewicz opened a new pull request, #50956: URL: https://github.com/apache/arrow/pull/50956
### Rationale for this change GH-38809 reports that `pa.concat_tables` cannot promote struct types. That is no longer true: the snippet in the issue works from 19.0.0 onwards. Schema unification of structs was there from the start (`MergeStructs` in `cpp/src/arrow/type.cc`, added in #36846); what was missing was the cast side, which GH-44555 / #44587 fixed by letting `CastStruct` fill absent output fields with nulls. #45246 later added field reordering. None of that is covered by a Python test — the existing `test_concat_tables_with_promotion*` tests use flat types only — so the behaviour could regress unnoticed. These tests pin it down and give GH-38809 something to close on. ### What changes are included in this PR? Three tests in `python/pyarrow/tests/test_table.py`: * `test_concat_tables_with_struct_promotion` — the exact case from GH-38809: a struct field present in one table only is filled with null, `null`-typed fields are promoted, and the unified struct keeps the first table's field order. * `test_concat_tables_with_nested_struct_promotion` — `int32` and `float64` nested inside a struct promote to `float64` under `permissive`, and still fail under `default`. * `test_concat_tables_with_list_of_struct_promotion` — the same promotion below a list. No library changes. ### Are these changes tested? They are tests. Verified: `pytest -k struct_promotion` against pyarrow 25.0.1 → 3 passed. The first case fails on 18.1.0 with exactly the error quoted in GH-38809 (`struct fields don't match or are in the wrong order`) and passes on 19.0.0, which is how the fixing release was identified. ### Are there any user-facing changes? No. *This change was created with AI assistance.* The version bisect, the assertions and the claim about which commit fixed it were each checked by running them; the expected values in the tests are the observed output of `concat_tables`, not hand-written guesses. -- 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]
