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 2022/03/11 02:13:04 UTC

[GitHub] [arrow-rs] sunchao commented on a change in pull request #1420: Add value_unchecked() and unit test

sunchao commented on a change in pull request #1420:
URL: https://github.com/apache/arrow-rs/pull/1420#discussion_r824331630



##########
File path: arrow/src/array/array_binary.rs
##########
@@ -473,6 +473,18 @@ impl FixedSizeBinaryArray {
         }
     }
 
+    /// Returns the element at index `i` as a byte slice.
+    /// # Safety
+    /// Caller is responsible for ensuring that the index is within the bounds of the array
+    pub unsafe fn value_unchecked(&self, i: usize) -> &[u8] {
+        let offset = i.checked_add(self.data.offset()).unwrap();

Review comment:
       can we change `value` to use this in order to avoid code duplication?

##########
File path: arrow/src/array/array_binary.rs
##########
@@ -473,6 +473,18 @@ impl FixedSizeBinaryArray {
         }
     }
 
+    /// Returns the element at index `i` as a byte slice.
+    /// # Safety

Review comment:
       nit: can we add blank lines before & after?




-- 
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-unsubscribe@arrow.apache.org

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