rluvaton commented on code in PR #6893:
URL: https://github.com/apache/arrow-rs/pull/6893#discussion_r1888681995
##########
arrow-select/src/concat.rs:
##########
@@ -851,4 +1018,169 @@ mod tests {
assert_eq!(array.null_count(), 10);
assert_eq!(array.logical_null_count(), 10);
}
+
+ #[test]
+ fn concat_dictionary_list_array_simple() {
+ let scalars = vec![
+ create_single_row_list_of_dict(vec![Some("a")]),
+ create_single_row_list_of_dict(vec![Some("a")]),
+ create_single_row_list_of_dict(vec![Some("b")]),
+ ];
+
+ let arrays = scalars.iter().map(|a| a as &(dyn
Array)).collect::<Vec<_>>();
+ let concat_res = concat(arrays.as_slice()).unwrap();
+
+ let expected_list = create_list_of_dict(vec![
+ // Row 1
+ Some(vec![Some("a")]),
+ Some(vec![Some("a")]),
+ Some(vec![Some("b")]),
+ ]);
+
+ let list = concat_res.as_list::<i32>();
+
+ // Assert that the list is equal to the expected list
+ list.iter().zip(expected_list.iter()).for_each(|(a, b)| {
+ assert_eq!(a, b);
+ });
+
+ let dict = list
+ .values()
+ .as_dictionary::<Int32Type>()
+ .downcast_dict::<StringArray>()
+ .unwrap();
+ println!("{:?}", dict);
+
+ assert_dictionary_has_unique_values::<_, StringArray>(
+ list.values().as_dictionary::<Int32Type>(),
+ );
+ }
+
+ #[test]
+ fn concat_dictionary_list_array_with_multiple_rows() {
Review Comment:
this test fails because there are more keys than there are values, which is
weird, see why here:
- https://github.com/apache/arrow-rs/issues/6888#issuecomment-2548648179
Should I remove this test or what?
--
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]