ding-young commented on code in PR #7627:
URL: https://github.com/apache/arrow-rs/pull/7627#discussion_r2258660485
##########
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();
+ }
+
+ #[test]
+ fn test_list_of_primitive_dictionary() {
+ let mut builder =
+ ListBuilder::<PrimitiveDictionaryBuilder<Int32Type,
Int32Type>>::default();
+ builder.values().append(2).unwrap();
+ builder.values().append(3).unwrap();
+ builder.values().append(0).unwrap();
+ builder.values().append_null();
+ builder.values().append(5).unwrap();
+ builder.values().append(3).unwrap();
+ builder.values().append(-1).unwrap();
+ builder.append(true);
Review Comment:
Done.
--
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]