jhorstmann commented on code in PR #1048:
URL: https://github.com/apache/arrow-rs/pull/1048#discussion_r889509824


##########
arrow/src/array/array_dictionary.rs:
##########
@@ -163,6 +165,92 @@ impl<'a, K: ArrowPrimitiveType> DictionaryArray<K> {
         self.is_ordered
     }
 
+    /// Returns a DictionaryArray referencing the same data
+    /// with the [DictionaryArray::is_ordered] flag set to `true`.
+    /// Note that this does not actually reorder the values in the dictionary.
+    pub fn as_ordered(&self) -> Self {

Review Comment:
   Good point. I don't think it would be possible to trigger undefined behavior 
with this method, it would only sort differently. But it certainly makes an 
assumption that the compiler can not verify.
   
   Maybe the method could also have a better name, my intention was something 
like `assume_can_be_sorted_by_keys`. Even if the dictionary is not actually 
sorted, setting the flag allows useful behavior, like sorting by keys and then 
using `lexicographical_partition_ranges` with the same key-based comparator.



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