HuaHuaY commented on code in PR #50892:
URL: https://github.com/apache/arrow/pull/50892#discussion_r3920706296
##########
cpp/src/parquet/arrow/schema.cc:
##########
@@ -602,13 +628,21 @@ Status GroupToStruct(const GroupNode& node, LevelInfo
current_levels,
arrow_fields.push_back(out->children[i].field);
}
auto struct_type = ::arrow::struct_(arrow_fields);
- if (ctx->properties.get_arrow_extensions_enabled() &&
- node.logical_type()->is_variant()) {
- auto extension_type = ::arrow::GetExtensionType("arrow.parquet.variant");
- if (extension_type) {
- ARROW_ASSIGN_OR_RAISE(
- struct_type,
- extension_type->Deserialize(std::move(struct_type),
/*serialized_data=*/""));
+ if (ctx->properties.get_arrow_extensions_enabled()) {
+ if (node.logical_type()->is_variant()) {
+ auto extension_type = ::arrow::GetExtensionType("arrow.parquet.variant");
+ if (extension_type) {
+ ARROW_ASSIGN_OR_RAISE(
+ struct_type,
+ extension_type->Deserialize(std::move(struct_type),
/*serialized_data=*/""));
+ }
+ } else if (node.logical_type()->is_file()) {
+ auto extension_type =
::arrow::GetExtensionType(std::string(kFileExtensionName));
+ if (extension_type) {
+ ARROW_ASSIGN_OR_RAISE(
+ struct_type,
+ extension_type->Deserialize(std::move(struct_type),
/*serialized_data=*/""));
Review Comment:
Sorry, I didn't quite catch what you meant. As I understand it, `variant`
would return `Status::Invalid` in `VariantExtensionType::Make`, causing an
error here as well.
My reasoning here is that if a type is FILE-annotated and was written by us,
it is guaranteed to be correct. If it was written by another writer, then it
should be attributed to that writer's implementation. If we were to allow
arbitrary types to pass through, other code in the repository might encounter
unknown errors when processing this data.
--
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]