andylokandy commented on PR #6652:
URL: https://github.com/apache/arrow-rs/pull/6652#issuecomment-2447573349

   I'm the member of [databend](https://github.com/databendlabs/databend), 
which heavily adopt arrow-rs and I'm sure it is a very common pattern that 
constructing an item in a StringArrayBuilder/BinaryArrayBuilder by several 
parts of `&str` or `&[u8]`. 
   
   For example, to add a &[0x20] padding before each item of BinaryArray to 
generate a new BinaryArray, we can do the following:
   ```rust
   for x in array.iter() {
       write!(&mut builder, b" ").unwrap();
       write!(&mut builder, x).unwrap();
       builder.append_value("");
   }
   ```
   
   Moreover, `StringBuilder` has already supported [this 
pattern](https://docs.rs/arrow/latest/arrow/array/builder/type.GenericStringBuilder.html#:~:text=This%20builder%20also%20implements%20std%3A%3Afmt%3A%3AWrite%20with%20any%20written%20data%20included%20in%20the%20next%20appended%20value.%20This%20allows%20using%20std%3A%3Afmt%3A%3ADisplay%20with%20standard%20Rust%20idioms%20like%20write!%20and%20writeln!%20to%20write%20data%20directly%20to%20the%20builder%20without%20intermediate%20allocations.).
 We use it in databend smoothly and we hope BinaryBuilder can have the same 
ability.


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