scovich commented on code in PR #9677:
URL: https://github.com/apache/arrow-rs/pull/9677#discussion_r3064915735


##########
arrow-schema/src/field.rs:
##########
@@ -504,13 +504,39 @@ impl Field {
             .map(String::as_ref)
     }
 
+    /// Returns `true` if this [`Field`] has the given [`ExtensionType`] name
+    /// and can be successfully validated as that extension type.
+    ///
+    /// This first checks the extension type name and only calls
+    /// [`ExtensionType::validate`] when the name matches.
+    ///
+    /// This is useful when you only need a boolean validity check and do not
+    /// need to retrieve the extension type instance.
+    #[inline]
+    pub fn has_valid_extension_type<E: ExtensionType>(&self) -> bool {
+        if self.extension_type_name() != Some(E::NAME) {
+            return false;
+        }
+
+        let ext_metadata = self
+            .metadata()
+            .get(EXTENSION_TYPE_METADATA_KEY)
+            .map(|s| s.as_str());

Review Comment:
   Ah,  good point. And the two `as_str` forms are the same line length, so 
probably no point changing it unless you like the other form better.



-- 
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]

Reply via email to