viirya commented on code in PR #4081:
URL: https://github.com/apache/arrow-rs/pull/4081#discussion_r1170242829


##########
arrow-array/src/types.rs:
##########
@@ -1569,6 +1604,21 @@ impl<O: OffsetSizeTrait> ByteArrayType for 
GenericBinaryType<O> {
     } else {
         DataType::Binary
     };
+
+    fn validate(
+        offsets: &OffsetBuffer<Self::Offset>,
+        values: &Buffer,
+    ) -> Result<(), ArrowError> {
+        // offsets are guaranteed to be monotonically increasing and non-empty
+        let max_offset = offsets.last().unwrap().as_usize();
+        if values.len() < max_offset {
+            return Err(ArrowError::InvalidArgumentError(format!(
+                "Maximum offset of {max_offset} is larger than values of 
length {}",
+                values.len()

Review Comment:
   ```suggestion
                   "Maximum offset of {max_offset} is larger than length of 
values {}",
                   values.len()
   ```



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