You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/06/01 07:10:18 UTC

[GitHub] [arrow-rs] Dandandan commented on a change in pull request #353: Add append_slice for GenericStringBuilder

Dandandan commented on a change in pull request #353:
URL: https://github.com/apache/arrow-rs/pull/353#discussion_r642837631



##########
File path: arrow/src/array/builder.rs
##########
@@ -1246,6 +1247,33 @@ impl<OffsetSize: StringOffsetSizeTrait> GenericStringBuilder<OffsetSize> {
         Ok(())
     }
 
+    /// Appends a UTF-8 slice into the builder.
+    ///
+    /// Automatically calls the `append` method to delimit the slice appended in as a
+    /// distinct array element.
+    #[inline]
+    pub fn append_slice(&mut self, value: &[u8]) -> Result<()> {
+        // Do not append invalid UTF-8
+        from_utf8(value).or(Err(ArrowError::InvalidArgumentError(

Review comment:
       I think this `or` should be using `or_else` here otherwise the error path is always evaluated




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org