Copilot commented on code in PR #50892:
URL: https://github.com/apache/arrow/pull/50892#discussion_r3956478614
##########
cpp/src/parquet/arrow/schema.cc:
##########
@@ -497,6 +518,11 @@ Status FieldToNode(const std::string& name, const
std::shared_ptr<Field>& field,
return VariantToNode(variant_type, name, field->nullable(), field_id,
properties,
arrow_properties, out);
+ } else if (ext_type->extension_name() == kFileExtensionName) {
+ auto file_type =
std::static_pointer_cast<::arrow::extension::FileExtensionType>(
+ field->type());
+ return FileToNode(file_type, name, field->nullable(), field_id,
properties,
+ arrow_properties, out);
}
Review Comment:
`std::static_pointer_cast<FileExtensionType>(field->type())` is unsafe here:
checking `extension_name()` doesn’t guarantee the concrete C++ type is actually
`FileExtensionType` (a different `ExtensionType` could legally report the same
name), so this can become UB. Prefer a `dynamic_pointer_cast` + explicit error
to fail safely.
--
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]