kylebarron commented on PR #6924:
URL: https://github.com/apache/arrow-rs/pull/6924#issuecomment-2571397666

   IMO this looks great. It should make it easier 
   
   I was just trying to figure out what this provided that `ArrayAccessor` 
didn't provide directly, and I didn't realize that `ArrayAccessor` only 
provided `value` and `value_unchecked`. So having this `BinaryArrayType` would 
be nicer to be able to use iterator methods over any generic binary array input.
   
   ```rs
       fn use_binary_array<'a>(array: impl arrow_array::ArrayAccessor<Item = 
&'a [u8]>) {
           // Have to manually iterate over the array
           for i in 0..array.len() {
               dbg!(String::from_utf8(array.value(i).to_vec()).unwrap());
           }
       }
   
       #[test]
       fn binary_array() {
           let mut builder = BinaryViewBuilder::new();
           builder.append_value(b"foo");
           builder.append_value(b"bar");
           builder.append_value(b"baz");
           use_binary_array(&builder.finish());
   
           let mut builder = FixedSizeBinaryBuilder::new(3);
           builder.append_value(b"foo").unwrap();
           builder.append_value(b"bar").unwrap();
           builder.append_value(b"baz").unwrap();
           use_binary_array(&builder.finish());
       }
   ```


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