tustvold commented on code in PR #3168:
URL: https://github.com/apache/arrow-rs/pull/3168#discussion_r1031228271


##########
arrow-array/src/array/string_array.rs:
##########
@@ -216,8 +216,19 @@ impl<OffsetSize: OffsetSizeTrait> 
From<GenericBinaryArray<OffsetSize>>
     for GenericStringArray<OffsetSize>
 {
     fn from(v: GenericBinaryArray<OffsetSize>) -> Self {
+        let offsets = v.value_offsets();
+        let values = v.data().buffers()[1].as_ref();
+
+        // We only need to validate that all values are valid UTF-8
+        let validated = std::str::from_utf8(values).unwrap();
+        for offset in offsets.iter() {
+            assert!(validated.is_char_boundary(offset.as_usize()))
+        }

Review Comment:
   No, in case the string is sliced



-- 
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: github-unsubscr...@arrow.apache.org

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

Reply via email to