ding-young commented on code in PR #7627: URL: https://github.com/apache/arrow-rs/pull/7627#discussion_r2284086740
########## arrow-row/src/lib.rs: ########## @@ -1863,6 +1887,64 @@ mod tests { back[0].to_data().validate_full().unwrap(); } + #[test] + fn test_dictionary_in_struct() { + let ty = DataType::Struct( + vec![Field::new_dictionary( + "foo", + DataType::Int32, + DataType::Int32, + false, + )] + .into(), + ); + let s = arrow_array::new_empty_array(&ty); + + let sort_fields = vec![SortField::new(s.data_type().clone())]; + let converter = RowConverter::new(sort_fields).unwrap(); + let r = converter.convert_columns(&[Arc::clone(&s)]).unwrap(); + + let back = converter.convert_rows(&r).unwrap(); + let [s2] = back.try_into().unwrap(); + + // RowConverter flattens Dictionary + // s.ty = Struct(foo Dictionary(Int32, Int32)), s2.ty = Struct(foo Int32) + assert_ne!(&s.data_type(), &s2.data_type()); + + s2.to_data().validate_full().unwrap(); Review Comment: Since this test uses an empty array, I updated the test to only check both lengths are 0. Other tests handle value level assertions. -- 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