Jefffrey opened a new issue, #11198:
URL: https://github.com/apache/arrow-rs/issues/11198

   ### Describe the bug
   
   
https://github.com/apache/arrow-rs/blob/83ebd7248be4779700ab81dddd14d63c87fe5109/arrow-data/src/transform/union.rs#L80-L84
   
   
https://github.com/apache/arrow-rs/blob/83ebd7248be4779700ab81dddd14d63c87fe5109/arrow-data/src/transform/union.rs#L107-L111
   
   it assumes a non-empty unionfields, but an empty union is valid
   
   ### To Reproduce
   
   reproduction from codex:
   
   ```rust
   // arrow-data/src/transform/mod.rs
       #[test]
       fn empty_union_extend_zero_nulls() {
           use arrow_schema::UnionFields;
   
           for mode in [UnionMode::Sparse, UnionMode::Dense] {
               let mut builder = 
ArrayData::builder(DataType::Union(UnionFields::empty(), mode))
                   .len(0)
                   .add_buffer(Buffer::from_vec(Vec::<i8>::new()));
   
               if mode == UnionMode::Dense {
                   builder = 
builder.add_buffer(Buffer::from_vec(Vec::<i32>::new()));
               }
   
               let source = builder.build().unwrap();
               let mut mutable = MutableArrayData::new(vec![&source], true, 0);
   
               mutable.try_extend_nulls(0);
           }
       }
   ```
   
   ### Expected behavior
   
   this should not panic. need to consider what expected behaviour is though, 
as there are no child type ids to extend 🤔 
   
   ### Additional context
   
   _No response_


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