vegarsti commented on code in PR #8659:
URL: https://github.com/apache/arrow-rs/pull/8659#discussion_r2484775860
##########
arrow-array/src/array/byte_array.rs:
##########
@@ -190,6 +190,29 @@ impl<T: ByteArrayType> GenericByteArray<T> {
Scalar::new(Self::from_iter_values(std::iter::once(value)))
}
+ /// Create a new [`GenericByteArray`] where `value` is repeated
`repeat_count` times.
+ ///
+ /// # Panics
+ /// This will panic if value's length multiplied by `repeat_count`
overflows usize.
+ ///
+ pub fn new_repeated(value: impl AsRef<T::Native>, repeat_count: usize) ->
Self {
+ let s: &[u8] = value.as_ref().as_ref();
+ let value_offsets = OffsetBuffer::from_repeated_length(s.len(),
repeat_count);
+ let bytes: Buffer = {
+ let mut mutable_buffer = MutableBuffer::with_capacity(0);
Review Comment:
Thanks!
--
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]