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:
[email protected]