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


##########
datafusion/functions/src/strings.rs:
##########
@@ -214,16 +221,23 @@ impl StringViewArrayBuilder {
         }
     }
 
+    /// Finalizes the current row by converting the accumulated data into a
+    /// StringView and appending it to the views buffer.
     pub fn append_offset(&mut self) -> Result<()> {
-        let block_str = if self.tainted {
+        if self.tainted {
             std::str::from_utf8(&self.block)
-                .map_err(|_| exec_datafusion_err!("invalid UTF-8 in binary 
literal"))?
-        } else {
-            // SAFETY: all data that was appended was valid UTF8
-            unsafe { std::str::from_utf8_unchecked(&self.block) }
-        };
-        self.builder.append_value(block_str);
+                .map_err(|_| exec_datafusion_err!("invalid UTF-8 in binary 
literal"))?;
+        }
+
+        let v = &self.block;
+        let offset = self.data.len() as u32;

Review Comment:
   Good catch! Thank you.



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