Rich-T-kid commented on code in PR #11407:
URL: https://github.com/apache/arrow-rs/pull/11407#discussion_r4274446725


##########
arrow-cmp/src/lib.rs:
##########
@@ -234,6 +253,93 @@ fn compare_dict<K: ArrowDictionaryKeyType>(
     Ok(f)
 }
 
+#[inline]
+fn compare_dict_bytes<K: ArrowDictionaryKeyType, T: ByteArrayType>(
+    left: &DictionaryArray<K>,
+    right: &DictionaryArray<K>,
+    opts: SortOptions,
+) -> DynComparator {
+    let left_values = left.values().as_bytes::<T>().clone();
+    let right_values = right.values().as_bytes::<T>().clone();
+    let left_keys = left.keys().values().clone();
+    let right_keys = right.keys().values().clone();
+    // SAFETY: row indices are in-bounds per DynComparator contract; keys are
+    // in-bounds for values per DictionaryArray::try_new.

Review Comment:
   by `DynComparator` contract I was referring to placing the responsibility on 
the caller but your right we shouldn't have a safe function that can cause UB.
   
   updated the 2 two functions



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