mbrobbel commented on code in PR #8350:
URL: https://github.com/apache/arrow-rs/pull/8350#discussion_r2357766806


##########
arrow-schema/src/field.rs:
##########
@@ -391,6 +398,49 @@ impl Field {
     /// ```
     pub fn with_data_type(mut self, data_type: DataType) -> Self {
         self.set_data_type(data_type);
+        self.without_extension_type()

Review Comment:
   I agree that this is not a good solution. It would be nice to prevent 
invalid state via the API of `Field`, however, with `set_metadata` and 
`metadata_mut` it's already possible to set datatype incompatible extension 
type information, so either we accept it (and replace the clear calls added in 
this PR with a warning in the docs) or we reconsider the mutating methods of 
the `Field` API.
   
   > Seems better to make this fallible (with_data_type becomes 
try_with_data_type), and blow up if the new data type is incompatible with the 
currently-installed extension type?
   
   The problem is you can't check data type compatibility without the actual 
extension type.



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