neilconway commented on code in PR #26377:
URL: https://github.com/apache/datafusion/pull/26377#discussion_r4285921526


##########
datafusion/functions/src/strings.rs:
##########
@@ -829,38 +832,78 @@ impl StringViewArrayBuilder {
         Self::make_long_view_checked(length, buffer_index, offset, 
prefix_bytes)
     }
 
-    /// See [`BulkNullStringArrayBuilder::append_byte_map`].
+    /// Fallible variant of [`Self::append_byte_map`].
     ///
     /// # Safety
     ///
     /// The bytes produced by applying `map` to each byte of `src`, in order,
     /// must form valid UTF-8.
     ///
-    /// # Panics
+    /// # Errors
     ///
-    /// Panics under the same conditions as [`Self::append_value`]: if
-    /// `src.len()`, the in-progress buffer offset, or the number of completed
-    /// buffers exceeds `i32::MAX`.
+    /// Returns an error under the same conditions as
+    /// [`Self::try_append_value`].
     #[inline]
-    pub unsafe fn append_byte_map<F: FnMut(u8) -> u8>(&mut self, src: &[u8], 
mut map: F) {
-        let length: u32 =
-            i32::try_from(src.len()).expect("value length exceeds i32::MAX") 
as u32;
-        if length <= 12 {
-            let mut bytes = [0u8; 12];
-            for (d, &b) in bytes[..src.len()].iter_mut().zip(src) {
+    pub unsafe fn try_append_byte_map<F: FnMut(u8) -> u8>(

Review Comment:
   Seems like we're okay here as-is.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to