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


##########
arrow-array/src/array/byte_view_array.rs:
##########
@@ -318,49 +318,53 @@ impl<T: ByteViewType + ?Sized> GenericByteViewArray<T> {
     }
 
     /// Returns an iterator over the prefix bytes of this array with respect 
to the prefix length.
-    /// If the prefix length is larger than the string length, it will return 
the empty slice.
-    pub fn prefix_bytes_iter(&self, prefix_len: usize) -> impl Iterator<Item = 
&[u8]> {
-        self.views().into_iter().map(move |v| {
-            let len = (*v as u32) as usize;
-
-            if len < prefix_len {
-                return &[] as &[u8];
-            }
-
-            if prefix_len <= 4 || len <= 12 {
-                unsafe { StringViewArray::inline_value(v, prefix_len) }
+    /// If the prefix length is larger than the string length, it will return 
None.
+    pub fn prefix_bytes_iter(&self, prefix_len: usize) -> impl Iterator<Item = 
Option<&[u8]>> {
+        self.views().into_iter().enumerate().map(move |(i, v)| {
+            if self.is_null(i) {
+                None

Review Comment:
   I was suggesting simply not checking the null mask at all



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

Reply via email to