friendlymatthew commented on code in PR #8666:
URL: https://github.com/apache/arrow-rs/pull/8666#discussion_r2445744332
##########
parquet-variant-compute/src/shred_variant.rs:
##########
@@ -380,6 +381,73 @@ mod tests {
shred_variant(&input, &list_schema).expect_err("unsupported");
}
+ #[test]
+ fn test_invalid_fixed_size_binary_shredding() {
+ let mock_uuid_1 = Uuid::new_v4();
+
+ let input = VariantArray::from_iter([Some(Variant::from(mock_uuid_1)),
None]);
+
+ // shred_variant only supports FixedSizeBinary(16). Any other length
will err.
+ let err = shred_variant(&input,
&DataType::FixedSizeBinary(17)).unwrap_err();
+
+ assert_eq!(
+ err.to_string(),
+ "Invalid argument error: FixedSizeBinary(17) is not a valid
variant shredding type. Only FixedSizeBinary(16) for UUID is supported."
+ );
+ }
+
+ #[test]
+ fn test_uuid_shredding() {
+ let mock_uuid_1 = Uuid::new_v4();
+ let mock_uuid_2 = Uuid::new_v4();
+
+ let input = VariantArray::from_iter([
+ Some(Variant::from(mock_uuid_1)),
+ None,
+ Some(Variant::from(false)),
+ Some(Variant::from(mock_uuid_2)),
+ ]);
+
+ let variant_array = shred_variant(&input,
&DataType::FixedSizeBinary(16)).unwrap();
+
+ // // inspect the typed_value Field and make sure it contains the
canonical Uuid extension type
+ // let typed_value_field = variant_array
+ // .inner()
+ // .fields()
+ // .into_iter()
+ // .find(|f| f.name() == "typed_value")
+ // .unwrap();
+
+ // assert!(
+ // typed_value_field
+ // .try_extension_type::<extension::Uuid>()
+ // .is_ok()
+ // );
+
+ // probe the downcasted typed_value array to make sure uuids are
shredded correctly
Review Comment:
To get this assertion to pass, significant changes would be needed to
correctly plumb the `FieldRef` through the code.
Since checking for extension types primarily improves correctness, doesn't
block the initial impl, and would add considerable noise to this PR, I plan to
address it in a follow-up
--
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]