crepererum commented on code in PR #3558:
URL: https://github.com/apache/arrow-rs/pull/3558#discussion_r1315916836


##########
arrow-select/src/interleave.rs:
##########
@@ -280,6 +322,32 @@ mod tests {
         )
     }
 
+    #[test]
+    fn test_interleave_dictionary() {
+        let a = DictionaryArray::<Int32Type>::from_iter(["a", "b", "c", "a", 
"b"]);
+        let b = DictionaryArray::<Int32Type>::from_iter(["a", "c", "a", "c", 
"a"]);
+
+        // Should not recompute dictionary
+        let values =
+            interleave(&[&a, &b], &[(0, 2), (0, 2), (0, 2), (1, 0), (1, 1), 
(0, 1)])
+                .unwrap();
+        let v = values.as_dictionary::<Int32Type>();
+        assert_eq!(v.values().len(), 5);
+
+        let vc = v.downcast_dict::<StringArray>().unwrap();
+        let collected: Vec<_> = vc.into_iter().map(Option::unwrap).collect();
+        assert_eq!(&collected, &["c", "c", "c", "a", "c", "b"]);
+
+        // Should recompute dictionary

Review Comment:
   I don't understand why this one is recomputed but the other case isn't.



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