friendlymatthew opened a new pull request, #8891:
URL: https://github.com/apache/arrow-rs/pull/8891

   # Rationale for this change
   
   This PR introduces `UnionFields::try_new` and `UnionFields::from_fields` as 
replacements for the "unsafe" `UnionFields::new` constructor, which is now 
deprecated
   
   Previously, `UnionFields` could be constructed with invalid invariants 
including negative type ids, duplicate type ids, or duplicate fields. Since 
`UnionArrays` index by type id, negative values cause panics at runtimes and 
duplicates break comparisons.
   
   `UnionFields::try_new` validates that type ids are non-negative, unique, 
under 128, and that fields are unique, returning an error if any constraint is 
violated. 
   
   `UnionFields::from_fields` is a convenience constructor that auto-assigns 
sequential type ids starting from 0. (Will panic if it exceeds 128 elements)


-- 
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]

Reply via email to