Cintu07 opened a new pull request, #11258: URL: https://github.com/apache/arrow-rs/pull/11258
### Which issue does this PR close? - Closes #11197. ### Rationale for this change new_null took the first union field without checking there was one, so an empty union panicked on the unwrap. len 0 is the only length an empty union can represent. every slot carries a type id naming one of the children, and UnionArray::try_new rejects a type id that names none. ### What changes are included in this PR? an empty union at len 0 builds the empty buffers, type ids plus offsets when dense, and no children. any other length panics saying what is missing, the same shape as FixedSizeBinary with a negative width. new_null returns Self, so the alternative is data that fails later in validate_full. ### Are these changes tested? yes. test_new_null_empty_union covers both modes at len 0 and runs validate_full, test_new_null_empty_union_with_slots pins the panic. arrow-data is 63 + 13 green, arrow-array 725, clippy clean. ### Are there any user-facing changes? new_null on an empty union of length 0 returns an array instead of panicking. no api changes. -- 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]
