mbrobbel commented on code in PR #5822:
URL: https://github.com/apache/arrow-rs/pull/5822#discussion_r1925942369
##########
parquet/src/arrow/schema/mod.rs:
##########
@@ -2163,4 +2211,52 @@ mod tests {
fn test_get_arrow_schema_from_metadata() {
assert!(get_arrow_schema_from_metadata("").is_err());
}
+
+ #[test]
+ #[cfg(feature = "arrow_canonical_extension_types")]
+ fn arrow_uuid_to_parquet_uuid() -> Result<()> {
+ let arrow_schema = Schema::new(vec![Field::new(
+ "uuid",
+ DataType::FixedSizeBinary(16),
+ false,
+ )
+ .with_extension_type(Uuid)]);
+
+ let parquet_schema =
ArrowSchemaConverter::new().convert(&arrow_schema)?;
+
+ assert_eq!(
+ parquet_schema.column(0).logical_type(),
+ Some(LogicalType::Uuid)
+ );
+
+ // TODO: roundtrip
+ // let arrow_schema = parquet_to_arrow_schema(&parquet_schema, None)?;
+ // assert_eq!(arrow_schema.field(0).try_extension_type::<Uuid>()?,
Uuid);
+
+ Ok(())
+ }
+
+ #[test]
+ #[cfg(feature = "arrow_canonical_extension_types")]
+ fn arrow_json_to_parquet_json() -> Result<()> {
+ let arrow_schema = Schema::new(vec![
+ Field::new("json", DataType::Utf8,
false).with_extension_type(Json::default())
+ ]);
+
+ let parquet_schema =
ArrowSchemaConverter::new().convert(&arrow_schema)?;
+
+ assert_eq!(
+ parquet_schema.column(0).logical_type(),
+ Some(LogicalType::Json)
+ );
+
+ // TODO: roundtrip
+ // let arrow_schema = parquet_to_arrow_schema(&parquet_schema, None)?;
+ // assert_eq!(
+ // arrow_schema.field(0).try_extension_type::<Json>()?,
+ // Json::default()
+ // );
Review Comment:
Yes, this requires a bit more work to propagate correctly.
--
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]