paleolimbot commented on code in PR #45866:
URL: https://github.com/apache/arrow/pull/45866#discussion_r2023312972
##########
cpp/src/parquet/arrow/arrow_schema_test.cc:
##########
@@ -948,6 +949,68 @@ TEST_F(TestConvertParquetSchema,
ParquetSchemaArrowExtensions) {
}
}
+TEST_F(TestConvertParquetSchema, ParquetSchemaArrowUuidExtension) {
+ std::vector<NodePtr> parquet_fields;
+ parquet_fields.push_back(PrimitiveNode::Make("uuid", Repetition::OPTIONAL,
+ LogicalType::UUID(),
+
ParquetType::FIXED_LEN_BYTE_ARRAY, 16));
+
+ {
+ // Parquet file does not contain Arrow schema.
+ // By default, field should be treated as fixed_size_binary(16) in Arrow.
+ auto arrow_schema =
+ ::arrow::schema({::arrow::field("uuid",
::arrow::fixed_size_binary(16), true)});
+ std::shared_ptr<KeyValueMetadata> metadata{};
+ ASSERT_OK(ConvertSchema(parquet_fields, metadata));
+ CheckFlatSchema(arrow_schema);
+ }
+
+ {
+ // Parquet file does not contain Arrow schema.
+ // If Arrow extensions are enabled, field will be interpreted as uuid()
+ // extension field.
+ ArrowReaderProperties props;
+ props.set_arrow_extensions_enabled(true);
+ auto arrow_schema =
+ ::arrow::schema({::arrow::field("uuid", ::arrow::extension::uuid(),
true)});
+ std::shared_ptr<KeyValueMetadata> metadata{};
+ ASSERT_OK(ConvertSchema(parquet_fields, metadata, props));
+ CheckFlatSchema(arrow_schema);
+ }
+
+ {
+ // Parquet file contains Arrow schema.
+ // uuid will be interpreted as uuid() field
+ ArrowReaderProperties props;
+ props.set_arrow_extensions_enabled(false);
+ std::shared_ptr<KeyValueMetadata> field_metadata =
Review Comment:
I believe that it is to make sure that the extension type restoration
doesn't strip field metadata.
--
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]