alamb commented on code in PR #7731:
URL: https://github.com/apache/arrow-rs/pull/7731#discussion_r2160319037


##########
arrow-ord/src/cmp.rs:
##########
@@ -566,12 +566,18 @@ impl<'a, T: ByteViewType> ArrayOrd for &'a 
GenericByteViewArray<T> {
     type Item = (&'a GenericByteViewArray<T>, usize);
 
     fn is_eq(l: Self::Item, r: Self::Item) -> bool {
+        let l_view = unsafe { l.0.views().get_unchecked(l.1) };
+        let r_view = unsafe { r.0.views().get_unchecked(r.1) };
+        if l.0.data_buffers().is_empty() && r.0.data_buffers().is_empty() {
+            // Only need to compare the inlined bytes
+            let l_bytes = unsafe { 
GenericByteViewArray::<T>::inline_value(l_view, 12) };
+            let r_bytes = unsafe { 
GenericByteViewArray::<T>::inline_value(r_view, 12) };
+            return l_bytes.cmp(r_bytes).is_eq();
+        }
+
         // # Safety
         // The index is within bounds as it is checked in value()

Review Comment:
   nit: I think it would be good to move the `Safety` comment up along with the 
calls to `unsafe`



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