bharadwaj-pendyala opened a new pull request, #11840: URL: https://github.com/apache/arrow-rs/pull/11840
# Which issue does this PR close? - Closes #11575. # Rationale for this change `try_merge` couldn't actually produce duplicate type ids. If `other` brought a new field whose id was already taken, the trailing `try_new` pass rejected it. The TODOs were stale, and the error was a bare `duplicate type id: 0` that didn't say which union members clashed. # What changes are included in this PR? - When an incoming field is new and its type id is already in `output`, `try_merge` now returns a `SchemaError` naming both fields: `Fail to merge schema field 'c12' because type id 0 is already used by field 'c11'`. - The merged `UnionFields` is built from `output` directly, without the second pass through `try_new`. Both inputs are already valid, and the new check is the only way a duplicate could get in. - Both TODOs are removed. # Are these changes tested? Yes. The union block in `test_schema_merge` now merges two `c1` unions that put different fields under type id 0 and checks the new message. Without the `fields.rs` change it fails with `Invalid argument error: duplicate type id: 0`. # Are there any significant user-facing changes? The error variant for this case changes. `Field::try_merge` and `Schema::try_merge` now return `ArrowError::SchemaError` instead of `ArrowError::InvalidArgumentError`. `SchemaError` is the variant the type id mismatch check right above it already uses. The code, the test and this description were written with AI assistance (Claude). -- 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]
